Home >Backend Development >PHP Tutorial >Symfony Flex: Paving the Path to a Faster, Better Symfony
Symfony Flex: Modern Symfony project management tool
Symfony Flex is not the next version of Symfony, but a modern alternative to Symfony Installer, which is a Composer plugin that modifies the behavior of require
and update
commands. Symfony can perform additional tasks before and after the Composer task execution when installing or updating dependencies. This article will explore Symfony Flex and its relationship with Symfony 4 upgrades.
Core points:
web
directory replaced with public
directory, The temporary file is located in the /var
directory under the root directory of the project, the source code is located in the /src
directory, the configuration file is located in the /config
directory, and the template is located in the /templates
directory. Still under development:
Symfony Flex and Symfony 4 are still under development (as of November 2017). Some of the features mentioned in this article may have been changed. In particular, the function of using Makefile and make tools to build projects when Symfony/Console is not available is not stable at present.
The difference from the past:
The main difference is Flex's compatibility with Symfony 4 update:
public
Catalog Substitutionweb
Catalog:Align with other mainstream frameworks. /var
directory: /var/cache
subdirectory is used for long-term cache. /src
directory: no longer uses the /app
directory. /config
directory: /templates
Catalog: composer config extra.symfony.allow-contrib true
. Quick Start:
Create projects using the Symfony Skeleton App:
<code class="language-bash">composer create-project symfony/skeleton flexy</code>There are only
files in the /public
directory. The environment type is determined by the environment variables and the configuration is read from the index.php
directory. /config
Add Bundle:
<code class="language-bash">composer req template</code>Flex will automatically activate Bundle and set the
directory and /templates
file. config/packages/twig.yaml
Large Bundle:
For example, install EasyAdmin Bundle:
<code class="language-bash">composer req admin</code>This requires database configuration.
Unofficial Bundle:
Recipes that require community contributions to be enabled first:
<code class="language-bash">composer config extra.symfony.allow-contrib true</code>Then install the unofficial Bundle, such as Ramsey's UUID-Doctrine Bundle:
<code class="language-bash">composer req ramsey/uuid-doctrine</code>
Third-party tools:
Third-party tools require manual registration and removal.
Summary:
Symfony Flex is a modern way of installing and managing Symfony applications, and is a key step towards Symfony 4.
Symfony Flex FAQ:
composer require symfony/flex
. composer require
, composer remove
Remove.
Please note that the format of the picture remains the same.
The above is the detailed content of Symfony Flex: Paving the Path to a Faster, Better Symfony. For more information, please follow other related articles on the PHP Chinese website!