1- Symfony Flex Recipes
2- ====================
1+ Symfony Recipes
2+ ===============
33
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.
86
9- Creating Flex Recipes
10- ---------------------
7+ Creating Recipes
8+ ----------------
119
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
1412repositories, outside of your Composer package repository. They must follow the
1513``vendor/package/version/ `` directory structure, where ``version `` is the
1614minimum version supported by the recipe.
@@ -37,6 +35,12 @@ The following example shows the real directory structure of some Symfony recipes
3735All the ``manifest.json `` file contents are optional and they are divided into
3836options and configurators.
3937
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+
4044Options
4145-------
4246
@@ -81,12 +85,12 @@ Configurators
8185Recipes define the different tasks executed when installing a dependency, such
8286as running commands, copying files or adding new environment variables. Recipes
8387only 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
8589unconfiguring the dependencies.
8690
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 ``.
9094
9195``bundles `` Configurator
9296~~~~~~~~~~~~~~~~~~~~~~~~
@@ -106,7 +110,7 @@ enabled. The supported environments are ``dev``, ``prod``, ``test`` and ``all``
106110 }
107111 }
108112
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:
110114
111115.. code-block :: php
112116
@@ -151,7 +155,7 @@ the ``extra`` section of your ``composer.json`` file:
151155 }
152156 }
153157
154- Now you can use ``%MY_SPECIAL_DIR% `` in your Symfony Flex recipes.
158+ Now you can use ``%MY_SPECIAL_DIR% `` in your recipes.
155159
156160``copy-from-recipe `` Configurator
157161~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -183,7 +187,7 @@ files stored in the root of the Symfony project:
183187 }
184188 }
185189
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 ``
187191and ``.env.dist `` files:
188192
189193.. code-block :: bash
@@ -193,17 +197,17 @@ and ``.env.dist`` files:
193197 APP_DEBUG=1
194198 # ##< your-recipe-name-here ###
195199
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.
199203
200204``makefile `` Configurator
201205~~~~~~~~~~~~~~~~~~~~~~~~~
202206
203207Adds new tasks to the ``Makefile `` file stored in the root of the Symfony
204208project. Unlike other configurators, there is no specific entry in the manifest
205209file. 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).
207211
208212Similar to the ``env `` configurator, the contents are copied into the ``Makefile ``
209213file 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
233237~~~~~~~~~~~~~~~~~~~~~~~~~~
234238
235239Adds 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):
238242
239243.. code-block :: json
240244
@@ -258,8 +262,8 @@ Displays contents in the command console after the package has been installed.
258262Avoid outputting meaningless information and use it only when you need to show
259263help messages or the next step actions.
260264
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
263267colors `_ are supported too:
264268
265269.. code-block :: text
0 commit comments