@@ -12,9 +12,16 @@ The Contracts Component
12
12
Installation
13
13
------------
14
14
15
+ Contracts are provided as separate packages, so you can install only the ones
16
+ your projects really need:
17
+
15
18
.. code-block :: terminal
16
19
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
18
25
19
26
.. include :: /components/require_autoload.rst.inc
20
27
@@ -45,15 +52,15 @@ Design Principles
45
52
* Contracts must be backward compatible with existing Symfony components.
46
53
47
54
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:
50
57
51
58
.. code-block :: javascript
52
59
53
60
{
54
61
" ..." : " ..." ,
55
62
" provide" : {
56
- " symfony/cache-contracts- implementation" : " 1.0"
63
+ " symfony/cache-implementation" : " 1.0"
57
64
}
58
65
}
59
66
@@ -68,23 +75,4 @@ However, PHP-FIG has different goals and different processes. Symfony Contracts
68
75
focuses on providing abstractions that are useful on their own while still
69
76
compatible with implementations provided by Symfony.
70
77
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
-
90
78
.. _`PHP-FIG` : https://www.php-fig.org/
0 commit comments