Skip to content

Commit d14cd4f

Browse files
committed
Updated Symfony Contracts package names and installation
1 parent 59a7e51 commit d14cd4f

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

components/contracts.rst

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,16 @@ The Contracts Component
1212
Installation
1313
------------
1414

15+
Contracts are provided as separate packages, so you can install only the ones
16+
your projects really need:
17+
1518
.. code-block:: terminal
1619
17-
$ composer require symfony/contracts
20+
$ composer require symfony/cache-contracts
21+
$ composer require symfony/event-dispatcher-contracts
22+
$ composer require symfony/http-client-contracts
23+
$ composer require symfony/service-contracts
24+
$ composer require symfony/translation-contracts
1825
1926
.. include:: /components/require_autoload.rst.inc
2027

@@ -45,15 +52,15 @@ Design Principles
4552
* Contracts must be backward compatible with existing Symfony components.
4653

4754
Packages that implement specific contracts should list them in the ``provide``
48-
section of their ``composer.json`` file, using the
49-
``symfony/*-contracts-implementation`` convention. For example:
55+
section of their ``composer.json`` file, using the ``symfony/*-implementation``
56+
convention. For example:
5057

5158
.. code-block:: javascript
5259
5360
{
5461
"...": "...",
5562
"provide": {
56-
"symfony/cache-contracts-implementation": "1.0"
63+
"symfony/cache-implementation": "1.0"
5764
}
5865
}
5966
@@ -68,23 +75,4 @@ However, PHP-FIG has different goals and different processes. Symfony Contracts
6875
focuses on providing abstractions that are useful on their own while still
6976
compatible with implementations provided by Symfony.
7077

71-
Why Isn't this Package Split into Several Packages?
72-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
73-
74-
Putting all interfaces in one package eases discoverability and dependency
75-
management. Instead of dealing with a myriad of small packages and the
76-
corresponding matrix of versions, you only deal with one package and one
77-
version. Also when using IDE autocompletion or reading the source code, it makes
78-
it easier to figure out which contracts are provided.
79-
80-
There are two downsides to this approach:
81-
82-
* You may have unused files in your ``vendor/`` directory. This has no impact in
83-
practice because the file sizes are very small and there is no performance
84-
overhead at all since they are never loaded.
85-
* In the future, it will be impossible to use two different sub-namespaces in
86-
different major versions of the package. However, this package follows the
87-
:doc:`Symfony BC + deprecation </contributing/code/bc>` policies, with an
88-
additional restriction to never remove deprecated interfaces.
89-
9078
.. _`PHP-FIG`: https://www.php-fig.org/

0 commit comments

Comments
 (0)