1
- Symfony Flex Recipes
2
- ====================
1
+ Symfony Recipes
2
+ ===============
3
3
4
- `Symfony Flex `_ is the new way to manage dependencies in Symfony applications.
5
- One of its main features is the automatic installation, configuration and
6
- removal of dependencies. This automation is possible thanks to the **Symfony Flex
7
- Recipes **.
4
+ Symfony recipes allow the automation of Composer packages configuration via the
5
+ `Symfony Flex `_ Composer plugin.
8
6
9
- Creating Flex Recipes
10
- ---------------------
7
+ Creating Recipes
8
+ ----------------
11
9
12
- Symfony Flex recipes consist of a ``manifest.json `` config file and, optionally,
13
- any number of files and directories. Recipes must be stored on their own
10
+ Symfony recipes consist of a ``manifest.json `` config file and, optionally, any
11
+ number of files and directories. Recipes must be stored on their own
14
12
repositories, outside of your Composer package repository. They must follow the
15
13
``vendor/package/version/ `` directory structure, where ``version `` is the
16
14
minimum version supported by the recipe.
@@ -37,6 +35,12 @@ The following example shows the real directory structure of some Symfony recipes
37
35
All the ``manifest.json `` file contents are optional and they are divided into
38
36
options and configurators.
39
37
38
+ .. note ::
39
+
40
+ Don't create a recipe for Symfony bundles if the only configuration in the
41
+ manifest is the registration of the bundle for all environments, as this is
42
+ done automatically.
43
+
40
44
Options
41
45
-------
42
46
@@ -81,12 +85,12 @@ Configurators
81
85
Recipes define the different tasks executed when installing a dependency, such
82
86
as running commands, copying files or adding new environment variables. Recipes
83
87
only contain the tasks needed to install and configure the dependency because
84
- Symfony Flex is smart enough to reverse those tasks when uninstalling and
88
+ Symfony is smart enough to reverse those tasks when uninstalling and
85
89
unconfiguring the dependencies.
86
90
87
- Symfony Flex provides eight types of tasks, which are called **configurators **:
88
- ``copy-from-recipe ``, ``copy-from-package ``, ``bundles ``, ``env ``, `` makefile ``,
89
- ``composer-scripts ``, ``gitignore ``, and ``post-install-output ``.
91
+ There are eight types of tasks, which are called **configurators **:
92
+ ``copy-from-recipe ``, ``copy-from-package ``, ``bundles ``, ``env ``,
93
+ ``makefile ``, `` composer-scripts ``, ``gitignore ``, and ``post-install-output ``.
90
94
91
95
``bundles `` Configurator
92
96
~~~~~~~~~~~~~~~~~~~~~~~~
@@ -106,7 +110,7 @@ enabled. The supported environments are ``dev``, ``prod``, ``test`` and ``all``
106
110
}
107
111
}
108
112
109
- The previous recipe is transformed by Symfony Flex into the following PHP code:
113
+ The previous recipe is transformed into the following PHP code:
110
114
111
115
.. code-block :: php
112
116
@@ -151,7 +155,7 @@ the ``extra`` section of your ``composer.json`` file:
151
155
}
152
156
}
153
157
154
- Now you can use ``%MY_SPECIAL_DIR% `` in your Symfony Flex recipes.
158
+ Now you can use ``%MY_SPECIAL_DIR% `` in your recipes.
155
159
156
160
``copy-from-recipe `` Configurator
157
161
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -183,7 +187,7 @@ files stored in the root of the Symfony project:
183
187
}
184
188
}
185
189
186
- Symfony Flex turns that recipe into the following content appended to the ``.env ``
190
+ This recipe is converted into the following content appended to the ``.env ``
187
191
and ``.env.dist `` files:
188
192
189
193
.. code-block :: bash
@@ -193,17 +197,17 @@ and ``.env.dist`` files:
193
197
APP_DEBUG=1
194
198
# ##< your-recipe-name-here ###
195
199
196
- The ``###> your-recipe-name-here ### `` section separators are needed by
197
- Symfony Flex to detect the contents added by this dependency in case you
198
- uninstall it later. Don't remove or modify these separators.
200
+ The ``###> your-recipe-name-here ### `` section separators are needed by Symfony
201
+ to detect the contents added by this dependency in case you uninstall it later.
202
+ Don't remove or modify these separators.
199
203
200
204
``makefile `` Configurator
201
205
~~~~~~~~~~~~~~~~~~~~~~~~~
202
206
203
207
Adds new tasks to the ``Makefile `` file stored in the root of the Symfony
204
208
project. Unlike other configurators, there is no specific entry in the manifest
205
209
file. Define tasks by creating a ``Makefile `` file at the root of the recipe
206
- directory (Symfony Flex adds a ``PHP_EOL `` character after each line).
210
+ directory (a ``PHP_EOL `` character is added after each line).
207
211
208
212
Similar to the ``env `` configurator, the contents are copied into the ``Makefile ``
209
213
file and wrapped with section separators (``###> your-recipe-name-here ### ``)
@@ -233,8 +237,8 @@ script (``php-script`` for PHP scripts, ``script`` for any shell script and
233
237
~~~~~~~~~~~~~~~~~~~~~~~~~~
234
238
235
239
Adds patterns to the ``.gitignore `` file of the Symfony project. Define those
236
- patterns as a simple array of strings (Symfony Flex adds a ``PHP_EOL `` character
237
- after each line):
240
+ patterns as a simple array of strings (a ``PHP_EOL `` character is added after
241
+ each line):
238
242
239
243
.. code-block :: json
240
244
@@ -258,8 +262,8 @@ Displays contents in the command console after the package has been installed.
258
262
Avoid outputting meaningless information and use it only when you need to show
259
263
help messages or the next step actions.
260
264
261
- The contents must be defined in a file named ``post-install.txt `` (Symfony Flex
262
- adds a ``PHP_EOL `` character after each line). `Symfony Console styles and
265
+ The contents must be defined in a file named ``post-install.txt `` (a
266
+ ``PHP_EOL `` character is added after each line). `Symfony Console styles and
263
267
colors `_ are supported too:
264
268
265
269
.. code-block :: text
0 commit comments