Git Product home page Git Product logo

recipes's Introduction

Symfony Recipes

Symfony recipes allow the automation of Composer packages configuration via the Symfony Flex Composer plugin.

This repository contains "official" recipes for Composer packages endorsed by the Symfony Core Team. For contributed recipes, see the contrib repository.

See RECIPES.md for a full list of recipes that live in this repository.

Creating Recipes

Symfony recipes consist of a manifest.json config file and, optionally, any number of files and directories. Recipes must be stored on their own repositories, outside of your Composer package repository. They must follow the vendor/package/version/ directory structure, where version is the minimum version supported by the recipe.

The following example shows the real directory structure of some Symfony recipes:

symfony/
    console/
        3.3/
            bin/
            manifest.json
    framework-bundle/
        3.3/
            config/
            public/
            src/
            manifest.json
    requirements-checker/
        1.0/
            manifest.json

All the manifest.json file contents are optional and they are divided into options and configurators.

Note

Don't create a recipe for Symfony bundles if the only configuration in the manifest is the registration of the bundle for all environments, as this is done automatically.

Note

When creating a recipe, don't create bundle config files under config/packages/ when no options are set.

Updating Recipes

When a recipe needs to be updated, we try to minimize the impact for the current versions. Creating a new project with a set of dependencies should always use the same recipes to avoid differences between the generated code and the existing documentation, blog posts, videos for these versions.

As a rule of thumb, consider the same principles as semantic versioning:

  • Only change an existing recipe for a version in case of a bug (typos, mis-configuration, ...);
  • If the change is about a new best practice or a different way of doing something, do it for the next version of the dependency.

Options

aliases option

This option (not available in the recipes-contrib repository) defines one or more alternative names that can be used to install the dependency. Its value is an array of strings. For example, if a dependency is published as acme-inc/acme-log-monolog-handler, it can define one or more aliases to make it easier to install:

{
    "aliases": ["acme-log", "acmelog"]
}

Developers can now install this dependency with composer require acme-log.

Configurators

Recipes define the different tasks executed when installing a dependency, such as running commands, copying files or adding new environment variables. Recipes only contain the tasks needed to install and configure the dependency because Symfony is smart enough to reverse those tasks when uninstalling and unconfiguring the dependencies.

There are several types of tasks, which are called configurators: copy-from-recipe, copy-from-package, bundles, env, container composer-scripts, gitignore, and post-install-output.

bundles Configurator

Enables one or more bundles in the Symfony application by appending them to the bundles.php file. Its value is an associative array where the key is the bundle class name and the value is an array of environments where it must be enabled. The supported environments are dev, prod, test and all (which enables the bundle in all environments):

{
    "bundles": {
        "Symfony\\Bundle\\DebugBundle\\DebugBundle": ["dev", "test"],
        "Symfony\\Bundle\\MonologBundle\\MonologBundle": ["all"]
    }
}

The previous recipe is transformed into the following PHP code:

// config/bundles.php
return [
    'Symfony\Bundle\DebugBundle\DebugBundle' => ['dev' => true, 'test' => true],
    'Symfony\Bundle\MonologBundle\MonologBundle' => ['all' => true],
];

container Configurator

Adds new container parameters in the services.yaml file by adding your parameters in the container option.

This example creates a new locale container parameter with a default value in your container:

{
    "container": {
        "locale": "en"
    }
}

copy-from-package Configurator

Copies files or directories from the Composer package contents to the Symfony application. It's defined as an associative array where the key is the original file/directory and the value is the target file/directory.

Caution!

Copying files from the package should be avoided, except for some very specific use cases. Copying PHP files under the project's src/ directory is almost always a bad idea; consider adding a command in your bundle that is able to generate such PHP files instead.

This example copies the bin/check.php script of the package into the binary directory of the application:

{
    "copy-from-package": {
        "bin/check.php": "%BIN_DIR%/check.php"
    }
}

The %BIN_DIR% string is a placeholder that, when installing the recipe, is turned into the absolute path of the binaries directory of the Symfony app. These are the available placeholders: %BIN_DIR%, %CONF_DIR%, %CONFIG_DIR%, %SRC_DIR% %VAR_DIR% and %PUBLIC_DIR%.

Recipes must use these placeholders instead of hardcoding the paths to be truly reusable. The placeholder values can be overridden in the extra section of your composer.json file (where you can define your own placeholders too):

// composer.json
{
    "...": "...",

    "extra": {
        // overriding the value of the default placeholders
        "bin-dir": "bin/",
        "config-dir": "config/",
        "src-dir": "src/",
        "var-dir": "var/",
        "public-dir": "public/",

        // defining a custom placeholder (can be accessed using
        // %MY_SPECIAL_DIR% in the recipe)
        "my-special-dir": "..."
    }
}

copy-from-recipe Configurator

It's identical to copy-from-package but contents are copied from the recipe itself instead of from the Composer package contents. It's useful to copy the initial configuration of the dependency and even a simple initial structure of files and directories:

"copy-from-recipe": {
    "config/": "%CONFIG_DIR%/",
}

Avoid storing PHP files that should land under the src/ directory; consider adding a command in your bundle that is able to generate such PHP files instead.

env Configurator

Adds the given list of environment variables to the .env and .env.dist files stored in the root of the Symfony project:

{
    "env": {
        "APP_ENV": "dev"
    }
}

This recipe is converted into the following content appended to the .env and .env.dist files:

###> your-recipe-name-here ###
APP_ENV=dev
###< your-recipe-name-here ###

The ###> your-recipe-name-here ### section separators are needed by Symfony to detect the contents added by this dependency in case you uninstall it later. Don't remove or modify these separators.

Tip

Use %generate(secret)% as the value of any environment variable to replace it with a cryptographically secure random value of 16 bytes.

composer-scripts Configurator

Registers scripts in the auto-scripts section of the composer.json file to execute them automatically when running composer install and composer update. The value is an associative array where the key is the script to execute (including all its arguments and options) and the value is the type of script (php-script for PHP scripts, script for any shell script and symfony-cmd for Symfony commands):

{
    "composer-scripts": {
        "vendor/bin/security-checker security:check": "php-script",
        "make cache-warmup": "script",
        "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
    }
}

gitignore Configurator

Adds patterns to the .gitignore file of the Symfony project. Define those patterns as a simple array of strings (a PHP_EOL character is added after each line):

{
    "gitignore": [
        ".env",
        "/public/bundles/",
        "/var/",
        "/vendor/"
    ]
}

Similar to other configurators, the contents are copied into the .gitignore file and wrapped with section separators (###> your-recipe-name-here ###) that must not be removed or modified.

post-install-output Configurator

Displays contents in the command console after the package has been installed. Avoid outputting meaningless information and use it only when you need to show help messages or the next step actions.

The contents must be defined in a file named post-install.txt (a PHP_EOL character is added after each line). Symfony Console styles and colors are supported too:

<bg=blue;fg=white>              </>
<bg=blue;fg=white> What's next? </>
<bg=blue;fg=white>              </>

  * <fg=blue>Run</> your application:
    1. Change to the project directory
    2. Execute the <comment>make serve</> command;
    3. Browse to the <comment>http://localhost:8000/</> URL.

  * <fg=blue>Read</> the documentation at <comment>https://symfony.com/doc</>

add-lines Configurator

If no other configurators can meet your needs, the add-lines configurator can add entire lines to files, either at the top, bottom or after a target:

"add-lines": [
    {
        "file": "webpack.config.js",
        "content": "\nenables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)\n    .enableStimulusBridge('./assets/controllers.json')",
        "position": "after_target",
        "target": ".splitEntryChunks()"
    },
    {
        "file": "assets/app.js",
        "content": "import './bootstrap.js';",
        "position": "top",
        "warn_if_missing": true
    },
    {
        "file": "assets/translator.js",
        "content": "export * from '../var/translations';",
        "position": "bottom",
        "requires": "symfony/webpack-encore-bundle"
    }
]

Each item needs file, content and position, which can be top, bottom or after_target. If after_target is used, a target must also be specified, which is a string that will be searched for in the file.

If warn_if_missing is set to true, a warning will be shown to the user if the file or target isn't found. If requires is set, the rule will only be applied if the given package is installed.

Validation

When submitting a recipe, several checks are automatically executed to validate the recipe:

  • YAML files suffix must be .yaml, not .yml;
  • YAML files must be valid;
  • YAML files must use 4 space indentations;
  • YAML files use null instead of ~;
  • YAML files under config/packages must not define a "parameters" section;
  • JSON files must be valid;
  • JSON files must use 4 space indentations;
  • Aliases are only supported in the main repository, not the contrib one;
  • Aliases must not be already defined by another package;
  • Aliases are not in the list of special Composer commands (nothing, lock, and mirrors);
  • The manifest file only contains supported keys;
  • The package must exist on Packagist;
  • The package must have at least one version on Packagist;
  • The package must have an MIT or BSD license;
  • The package must be of type "symfony-bundle" if a bundle is registered in the manifest;
  • The package must have a registered bundle in the manifest if type is "symfony-bundle";
  • The package does not only register a bundle for all environments;
  • The package does not depend on symfony/symfony or symfony/security;
  • All text files should end with a newline;
  • All configuration file names under config should use the underscore notation;
  • No "semantically" empty configuration files are created under config/packages;
  • All files are stored under a directory referenced by the "copy-from-recipe" section of "manifest.json";
  • The pull request does not contain merge commits;
  • The Symfony website must be referenced using HTTPs.

Full Example

Combining all the above configurators you can define powerful recipes, like the one used by symfony/framework-bundle:

{
    "bundles": {
        "Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle": ["all"]
    },
    "copy-from-recipe": {
        "config/": "%CONFIG_DIR%/",
        "public/": "%PUBLIC_DIR%/",
        "src/": "%SRC_DIR%/"
    },
    "composer-scripts": {
        "cache:clear": "symfony-cmd",
        "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd"
    },
    "env": {
        "APP_ENV": "dev",
        "APP_SECRET": "%generate(secret)%"
    },
    "gitignore": [
        ".env",
        "/public/bundles/",
        "/var/",
        "/vendor/"
    ]
}

recipes's People

Contributors

alexander-schranz avatar bocharsky-bw avatar chalasr avatar derrabus avatar dunglas avatar fabpot avatar gnito-org avatar jameshemery avatar javiereguiluz avatar jean85 avatar jrushlow avatar kbond avatar kocal avatar lyrixx avatar maxhelias avatar nicolas-grekas avatar nyholm avatar ogizanagi avatar oskarstark avatar pablokowalczyk avatar ro0nl avatar simivar avatar sroze avatar stof avatar symfony-bot avatar teohhanhui avatar tobion avatar weaverryan avatar xabbuh avatar yceruto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

recipes's Issues

Doctrine Bundle: Hint in generated .env file does not work

Given, I've bootstrapped a new application this way:

composer create-project symfony/skeleton demo
cd demo
composer require cli orm

If I now look into my .env file, I see the following section:

###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For a sqlite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Set "serverVersion" to your server version to avoid edge-case exceptions and extra database calls
DATABASE_URL="mysql://[email protected]:3306/symfony?charset=utf8mb4&serverVersion=5.7"
###< doctrine/doctrine-bundle ###

Oh, that sounds like a good idea. So let's try that SQLite suggestion and set:

DATABASE_URL="sqlite:///%kernel.project_dir%/var/data.db"

bildschirmfoto 2017-08-11 um 10 35 25

I'm not sure if kernel parameters are supposed to work inside environment variables (I guess not). Of course, it works fine if I replace %kernel.project_dir% with the real path to the project, but I don't see how I should know that I'm supposed to do that.

A user that is new to symfony would be lead directly into an error message that is not helpful.

composer req orm doesn't install doctrine/orm

Because doctrine/orm is only a soft dependency of doctrine/doctrine-bundle.

The install currently fails with the following message:

!!    [LogicException]                                                             
!!    To configure the ORM layer, you must first install the doctrine/orm package.                                                                            

[RFC] Always put a reference configuration file for each recipe

My idea is to have for each recipe a commented reference configuration (in addition to uncommented minimal usefull config). In this way, we don't need to create config file and to search in options documentation: everything is here, under our eyes. It's verbose but this is no longer a problem now that each config has his own file. For example, debug recipe has actually no config file; would not it be useful to have for him a reference config file at the beginning of our projects, like this:

#debug:

    # Max number of displayed items past the first level, -1 means no limit
    #max_items:            2500

    # Max length of displayed strings, -1 means no limit
    #max_string_length:    -1

    # A stream URL where dumps should be written to
    #dump_destination:     null # Example: php://stderr

[Admin] EasyAdmin dependencies installation fails

The base to work with: https://github.com/Pierstoval/FlexDemo

Clone the project & run composer install

Or you can also run this:

composer create-project symfony/skeleton:3.3.x-dev demo
cd demo
composer req cli
composer req orm
composer req admin

Environment:

$ php --version
PHP 7.1.4-1+deb.sury.org~xenial+1 (cli) (built: Apr 11 2017 22:12:32) ( NTS )
Copyright (c) 1997-2017 The PHP Group
Zend Engine v3.1.0, Copyright (c) 1998-2017 Zend Technologies
    with Zend OPcache v7.1.4-1+deb.sury.org~xenial+1, Copyright (c) 1999-2017, by Zend Technologies

$ composer --version
Composer version 1.4.1 2017-03-10 09:29:45
 $ composer req admin

Using version ^1.16@dev for javiereguiluz/easyadmin-bundle
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 22 installs, 0 updates, 0 removals
  - Installing twig/twig (2.x-dev 0dbc6b8): Downloading (100%)
  - Installing twig/extensions (dev-master 7c3b21c): Downloading (100%)
  - Installing symfony/translation (dev-master 2a6f7a9): Downloading (100%)
    Detected auto-configuration settings for "symfony/translation"
  - Installing symfony/validator (dev-master fe6324d): Downloading (100%)
    Detected auto-configuration settings for "symfony/validator"
  - Installing symfony/twig-bridge (dev-master 8ccca1d): Downloading (100%)
  - Installing symfony/asset (dev-master 67ee69a): Downloading (100%)
  - Installing symfony/polyfill-util (dev-master 746bce0): Loading from cache
  - Installing symfony/polyfill-php56 (dev-master 1dd42b9): Loading from cache
  - Installing paragonie/random_compat (v2.0.10): Loading from cache
  - Installing symfony/polyfill-php70 (dev-master 13ce343): Loading from cache
  - Installing symfony/inflector (dev-master aed5a08): Downloading (100%)
  - Installing symfony/property-access (dev-master 1bb34c3): Downloading (100%)
  - Installing symfony/security (dev-master 39263c7): Downloading (100%)
  - Installing symfony/twig-bundle (dev-master 83802a4): Downloading (100%)
    Detected auto-configuration settings for "symfony/twig-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
  - Installing symfony/security-bundle (dev-master 2d38aa7): Downloading (100%)
    Detected auto-configuration settings for "symfony/security-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
  - Installing symfony/options-resolver (dev-master ff48982): Downloading (100%)
  - Installing symfony/intl (dev-master 84edbd6): Downloading (100%)
  - Installing symfony/polyfill-intl-icu (dev-master 2d6e2b2): Loading from cache
  - Installing symfony/form (dev-master 627eb8b): Downloading (100%)
  - Installing sensio/framework-extra-bundle (3.0.x-dev 6d6cbe9): Downloading (100%)
    Detected auto-configuration settings for "sensio/framework-extra-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
  - Installing pagerfanta/pagerfanta (dev-master 29aade6): Downloading (100%)
  - Installing javiereguiluz/easyadmin-bundle (dev-master 3859dcf): Downloading (100%)
    Detected auto-configuration settings for "javiereguiluz/easyadmin-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative %WEB_DIR% [KO]
 [KO]
Script assets:install --symlink --relative %WEB_DIR% returned with error code 1
!!
!!
!!
!!    [Symfony\Component\Config\Exception\FileLoaderLoadException]
!!    There is no extension able to load the configuration for "security" (in /mn
!!    t/e/dev/www/flex_tests/demo/etc/packages/security.yaml). Looked for namespa
!!    ce "security", found "framework", "doctrine", "easy_admin" in /mnt/e/dev/ww
!!    w/flex_tests/demo/etc/packages/security.yaml (which is loaded in resource "
!!    /mnt/e/dev/www/flex_tests/demo/etc/packages/security.yaml").
!!
!!
!!
!!
!!    [Symfony\Component\DependencyInjection\Exception\InvalidArgumentException]
!!    There is no extension able to load the configuration for "security" (in /mn
!!
!!    t/e/dev/www/flex_tests/demo/etc/packages/security.yaml). Looked for namespa
!!    ce "security", found "framework", "doctrine", "easy_admin"
!!
!!
!!
!!

Installation failed, reverting ./composer.json to its original content.

It seems that bundle dependencies are not added to the kernel ๐Ÿ˜•

$ git diff etc/bundles.php
diff --git a/etc/bundles.php b/etc/bundles.php
index 92fa3ac..8516baf 100644
--- a/etc/bundles.php
+++ b/etc/bundles.php
@@ -3,4 +3,5 @@
 return [
     'Symfony\Bundle\FrameworkBundle\FrameworkBundle' => ['all' => true],
     'Doctrine\Bundle\DoctrineBundle\DoctrineBundle' => ['all' => true],
+    'JavierEguiluz\Bundle\EasyAdminBundle\EasyAdminBundle' => ['all' => true],
 ];

What could be done wrong?

Should controllers be private by default?

Controllers must be public when they have a __construct() method. Given that we allow to inject everything in the controller methods, most people will never use any constructor in any controller.

So, should we make this change in the FrameworkBundle recipe?

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:

services:
    # default configuration for services in *this* file
    _defaults:
        # automatically injects dependencies in your services
        autowire: true
        # automatically registers your services as commands, event subscribers, etc.
        autoconfigure: true
        # this means you cannot fetch services directly from the container via $container->get()
        # if you need to do this, you can override this setting on individual services
        public: false

    # makes classes in src/ available to be used as services
    # this creates a service per class whose id is the fully-qualified class name
    App\:
        resource: '../src/*'
        # you can exclude directories or files
        # but if a service is unused, it's removed anyway
        exclude: '../src/{Entity,Repository,Tests}'

    # controllers are imported separately to make sure they're public
    # and have a tag that allows actions to type-hint services
    App\Controller\:
        resource: '../src/Controller'
-       public: true
        tags: ['controller.service_arguments']

Swiftmailer default URL

Regarding the Swiftmailer manifest the default value of the MAILER_URL parameter is smtp://localhost:25?encryption=&auth_mode=.

Which is an invalid url. I got the following exception : The encryption is not supported (note the double space between The & encryption)

Regarding of Symfony\Bundle\SwiftmailerBundle\DependencyInjection\SwiftmailerTransportFactory I found that the URL query part is parsed with parse_str and the values are added one after the other without trying to convert it.

We may have 2 strategies here :

  • Modifiy the resolveOptions method of SwiftmailerTransportFactory to replace empty string with null
  • Modify the value of the MAILER_URL parameter in the manifest, and remove these parameters

Cannot traverse an already closed generator exception in config:dump-reference command

Iโ€™m trying to dump the config of a bundle and I encounter the following issue: inside the \Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand::initializeBundles() method the code retrieves the bundle from the Kernel.
The Kernel returns a generator which the method tries to parse twice.
The PHP docs it states that generators are forward-only iterators, and cannot be rewound once iteration has started, so the second foreach loop will cause a:

[Exception]
Cannot traverse an already closed generator

[framework-bundle] Don't advice to install web-server-bundle when already installed

I installed the web-server-bundle but I'm still getting:

$ make serve
Server listening on http://127.0.0.1:8000
Quit the server with CTRL-C.
Run composer require symfony/web-server-bundle for a better web server
php -S 127.0.0.1:8000 -t web
PHP 7.1.3 Development Server started at Wed May  3 14:25:01 2017
Listening on http://127.0.0.1:8000

It seems I need to run bin/console server:start instead but this is not explained.
Also no post-install is shown to tell me I need to use something else?

Will env vars work on the Makefile?

Looking at this:

@test -f bin/console && bin/console cache:clear --no-warmup || rm -rf var/cache/*

The rm -rf var/cache/* part is not very granular. Would env vars work in this file so we only delete the current environment cache? Something like this:

@test -f bin/console && bin/console cache:clear --no-warmup || rm -rf var/cache/$(APP_ENV)

According to https://www.gnu.org/software/make/manual/html_node/Setting.html you can assign a default value to an env var:

APP_ENV ?= *

[api-platform/core] InvalidConfigurationException when execute recipe

When I try to install api-platform with Symfony Flex, an exception is throw.

Step to reproduce :

  1. Create a new project using composer create-project symfony/skeleton myapp
  2. Install API Platform using the api-platform/api-pack : composer require api-platform/api-pack

Output :

Using version ^2.1@dev for api-platform/api-pack
./composer.json has been updated
...
Writing lock file
Generating autoload files
Symfony operations: 7 recipes
  - Configuring symfony/translation (3.3): From github.com/symfony/recipes:master
  - Configuring symfony/twig-bundle (3.3): From github.com/symfony/recipes:master
  - Configuring symfony/security-bundle (3.3): From github.com/symfony/recipes:master
  - Configuring symfony/console (3.3): From github.com/symfony/recipes:master
  - Configuring doctrine/doctrine-cache-bundle (1.3.0): From auto-generated recipe
  - Configuring doctrine/doctrine-bundle (1.6): From github.com/symfony/recipes:master
  - Configuring api-platform/core (2.1): From github.com/symfony/recipes:master
Executing script make cache-warmup [KO]
 [KO]
Script make cache-warmup returned with error code 2
!!  PHP Fatal error:  Uncaught Symfony\Component\Config\Definition\Exception\InvalidConfigurationException: Unrecognized option "loader_paths" under "api_platform" in /home/jeremy/Workspace/todolist/myapp/vendor/symfony/config/Definition/ArrayNode.php:317
!!  Stack trace:
!!  #0 /home/jeremy/Workspace/todolist/myapp/vendor/symfony/config/Definition/BaseNode.php(264): Symfony\Component\Config\Definition\ArrayNode->normalizeValue(Array)
!!  #1 /home/jeremy/Workspace/todolist/myapp/vendor/symfony/config/Definition/Processor.php(33): Symfony\Component\Config\Definition\BaseNode->normalize(Array)
!!  #2 /home/jeremy/Workspace/todolist/myapp/vendor/symfony/config/Definition/Processor.php(50): Symfony\Component\Config\Definition\Processor->process(Object(Symfony\Component\Config\Definition\ArrayNode), Array)
!!  #3 /home/jeremy/Workspace/todolist/myapp/vendor/symfony/dependency-injection/Extension/Extension.php(94): Symfony\Component\Config\Definition\Processor->processConfiguration(Object(ApiPlatform\Core\Bridge\Symfony\Bundle\DependencyInjection\Configura in /home/jeremy/Workspace/todolist/myapp/vendor/symfony/config/Definition/ArrayNode.php on line 317
!!  
!!  Makefile:14: recipe for target 'cache-clear' failed
!!  
!!  make: *** [cache-clear] Error 255
!!  
!!  

Installation failed, reverting ./composer.json to its original content.

FrameworkBundle wrong Makefile when using cygwin

How to reproduce:
Install PHP under windows environment
Install cygwin
Install FrameworkBundle and Cli

Then try to make cache-clear.

Could not open input file: [cygwin_path]/bin/console

In Makefile $(shell which bin/console) retreives a cygwin path instead of windows path.
To fix this, we need check $OS environment variable and if it equals Windows_NT then use
cygpath to retreive a path to console script:

CONSOLE := $(shell cygpath -m "$(shell which bin/console)")

[Suggestion] use DATABASE_URL for DoctrineBundle rather than DB_URL

DATABASE_URL is the env variable used by Heroku by default for the main database (you can rename it to whatever you want instead of DATABASE if you really want your DB to be exposed as MAILER_URL, but I don't see the point).

And DATABASE_URL is also the variable used by major frameworks in other languages:

  • Rails uses it
  • the Django plugin adding support for URLs also uses DATABASE_URL by default.

So I suggest using it in the recipe for DoctrineBundle instead of DB_URL

Note that I know that my request is geared toward Heroku here, while it is not the only Paas. But I looked at other. Platform.sh does not expose the DB URL as its own env var at all (they have a single env var with a JSON describing relationships, so it requires custom parsing anyway). And for Sensio Cloud, I haven't found any (public) doc about the way it exposes DB credentials. But as you control it, it may even still be time to change the convention you use if you expose the URL as DB_URL (maybe exposing both to be BC).

What do you think @fabpot ?

Missing in readme how to add a repository

In Fabien's blog this is stated:

The "main" official repository, hosted at https://github.com/symfony/recipes will be opinionated. Submissions will be reviewed carefully. They will need approval from the Symfony core team (like pull requests on the main symfony/symfony repository). We want the utmost quality and the best developer experience.

But I could not find out what the requirements would be for such an addition. Lets say I would like to add a bundle, what would my PR need besides of that which you add in the contrib repository?

  • Would it have to include research on other (similar) bundles with pros and cons?
  • Would there be a quality requirement?
  • Stability requirement?
  • PSR Requirement?
  • What about testing requirements?
  • CI?

I know it's kinda fuzzy to define all those, but it would be nice to have an indication.

[framework-bundle] [bug] the proposed `Kernel::registerBundles` implementation is not consistent

yield ing bundle instances makes it incompatible with multiple iterations (Generators cannot be rewinded once iterated, generating this kind of exceptions:

bin/console config:dump framework
                                               
  [Exception]                                  
  Cannot traverse an already closed generator  
                                               

Exception trace:
 () at /home/florian/work/symfony/demo/vendor/symfony/framework-bundle/Command/AbstractConfigCommand.php:127
 Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand->initializeBundles() at /home/florian/work/symfony/demo/vendor/symfony/framework-bundle/Command/AbstractConfigCommand.php:56
 Symfony\Bundle\FrameworkBundle\Command\AbstractConfigCommand->findExtension() at /home/florian/work/symfony/demo/vendor/symfony/framework-bundle/Command/ConfigDumpReferenceCommand.php:88
 Symfony\Bundle\FrameworkBundle\Command\ConfigDumpReferenceCommand->execute() at /home/florian/work/symfony/demo/vendor/symfony/console/Command/Command.php:264
 Symfony\Component\Console\Command\Command->run() at /home/florian/work/symfony/demo/vendor/symfony/console/Application.php:887
 Symfony\Component\Console\Application->doRunCommand() at /home/florian/work/symfony/demo/vendor/symfony/console/Application.php:223
 Symfony\Component\Console\Application->doRun() at /home/florian/work/symfony/demo/vendor/symfony/framework-bundle/Console/Application.php:80
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at /home/florian/work/symfony/demo/vendor/symfony/console/Application.php:130
 Symfony\Component\Console\Application->run() at /home/florian/work/symfony/demo/bin/console:33

config:dump-reference [--format FORMAT] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command> [<name>] [<path>]

I propose either to return a typical array, or to use iterator_to_array in portions of code that needs multiple iterations, or refactor the way bundles are initialized.

Deprecation Notice for easyadmin

While migrating a project to flex, I got the following deprecation notice for easyadmin.
User Deprecated: The JavierEguiluz\Bundle\EasyAdminBundle\EasyAdminBundle class is deprecated since version 1.16 and will be removed in 2.0. Use the EasyCorp\Bundle\EasyAdminBundle\EasyAdminBundle class instead.
Flex installed latest v1.17.1 but registered the old (with 1.17) deprecated bundle class. Fixing without flex is a no brainer but with flex the manifest.json should be changed.

locale parameter defined under services

# composer create-project "symfony/skeleton:^3.3"
 .
Installing symfony/skeleton (v3.3.0)
  - Installing symfony/skeleton (v3.3.0): Downloading (100%)         
Created project in .
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 22 installs, 0 updates, 0 removals
  - Installing symfony/flex (v1.0.1): Loading from cache
    Detected auto-configuration settings for "symfony/flex"
    Setting configuration and copying files
  - Installing symfony/stopwatch (v3.3.0): Loading from cache
  - Installing symfony/routing (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/routing"
  - Installing symfony/polyfill-mbstring (v1.3.0): Loading from cache
  - Installing psr/log (1.0.2): Loading from cache
  - Installing symfony/debug (v3.3.0): Loading from cache
  - Installing symfony/http-foundation (v3.3.0): Loading from cache
  - Installing symfony/event-dispatcher (v3.3.0): Loading from cache
  - Installing symfony/http-kernel (v3.3.0): Loading from cache
  - Installing symfony/finder (v3.3.0): Loading from cache
  - Installing symfony/filesystem (v3.3.0): Loading from cache
  - Installing psr/container (1.0.0): Loading from cache
  - Installing symfony/dependency-injection (v3.3.0): Loading from cache
  - Installing symfony/config (v3.3.0): Loading from cache
  - Installing symfony/class-loader (v3.3.0): Loading from cache
  - Installing psr/simple-cache (1.0.0): Loading from cache
  - Installing psr/cache (1.0.1): Loading from cache
  - Installing symfony/cache (v3.3.0): Loading from cache
  - Installing doctrine/cache (v1.6.1): Loading from cache
  - Installing symfony/framework-bundle (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/framework-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
    Adding environment variable defaults
    Adding Makefile entries
    Adding entries to .gitignore
  - Installing symfony/yaml (v3.3.0): Loading from cache
  - Installing symfony/dotenv (v3.3.0): Loading from cache
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Skipping "assets:install --symlink --relative web" (needs symfony/console to run).

              
 What's next? 
              

  * Run your application:
    1. Change to the project directory
    2. Execute the make serve command;
    3. Browse to the http://localhost:8000/ URL.

  * Read the documentation at https://symfony.com/doc

# composer req console
Using version ^3.3 for symfony/console
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 1 install, 0 updates, 0 removals
  - Installing symfony/console (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/console"
    Setting configuration and copying files
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative %WEB_DIR% [OK]

# composer req "api-platform/api-pack:^2.1@dev" "
api-platform/core:^2.1@dev"
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 36 installs, 0 updates, 0 removals
  - Installing symfony/asset (v3.3.0): Loading from cache
  - Installing symfony/translation (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/translation"
    Setting configuration and copying files
    Setting parameters
  - Installing symfony/validator (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/validator"
  - Installing twig/twig (v2.3.2): Loading from cache
  - Installing symfony/twig-bridge (v3.3.0): Loading from cache
  - Installing symfony/twig-bundle (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/twig-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
  - Installing symfony/inflector (v3.3.0): Loading from cache
  - Installing paragonie/random_compat (v2.0.10): Loading from cache
  - Installing symfony/polyfill-php70 (v1.3.0): Loading from cache
  - Installing symfony/property-access (v3.3.0): Loading from cache
  - Installing symfony/polyfill-util (v1.3.0): Loading from cache
  - Installing symfony/polyfill-php56 (v1.3.0): Loading from cache
  - Installing symfony/security (v3.3.0): Loading from cache
  - Installing symfony/security-bundle (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/security-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
  - Installing symfony/expression-language (v3.3.0): Loading from cache
  - Installing webmozart/assert (1.2.0): Loading from cache
  - Installing phpdocumentor/reflection-common (1.0): Loading from cache
  - Installing phpdocumentor/type-resolver (0.2.1): Loading from cache
  - Installing phpdocumentor/reflection-docblock (3.1.1): Loading from cache
  - Installing doctrine/inflector (v1.1.0): Loading from cache
  - Installing doctrine/lexer (v1.0.1): Loading from cache
  - Installing doctrine/collections (v1.4.0): Loading from cache
  - Installing doctrine/annotations (v1.4.0): Loading from cache
    Detected auto-configuration settings for "doctrine/annotations"
  - Installing doctrine/common (v2.7.2): Loading from cache
  - Installing symfony/doctrine-bridge (v3.3.0): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.0): Loading from cache
    Detected auto-configuration settings for "doctrine/doctrine-cache-bundle"
    Enabling the package as a Symfony bundle
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing doctrine/dbal (v2.5.12): Loading from cache
  - Installing doctrine/doctrine-bundle (1.6.8): Loading from cache
    Detected auto-configuration settings for "doctrine/doctrine-bundle"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
    Adding environment variable defaults
  - Installing doctrine/instantiator (1.0.5): Loading from cache
  - Installing doctrine/orm (v2.5.6): Loading from cache
  - Installing symfony/serializer (v3.3.0): Loading from cache
    Detected auto-configuration settings for "symfony/serializer"
  - Installing symfony/property-info (v3.3.0): Loading from cache
  - Installing willdurand/negotiation (v2.3.1): Loading from cache
  - Installing api-platform/core (dev-master 070278b): Loading from cache
    Detected auto-configuration settings for "api-platform/core"
    Enabling the package as a Symfony bundle
    Setting configuration and copying files
    Detected auto-configuration settings for "api-platform/api-pack"
Writing lock file
Generating autoload files
Executing script make cache-warmup [OK]
Executing script assets:install --symlink --relative %WEB_DIR% [KO]
 [KO]
Script assets:install --symlink --relative %WEB_DIR% returned with error code 255
!!  
!!  Fatal error: Uncaught Symfony\Component\DependencyInjection\Exception\InvalidArgumentException: A service definition must be an array or a string starting with "@" but string found for service "locale" in /srv/api-platform/etc/container.yaml. Check your YAML syntax. in /srv/api-platform/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php:336
!!  Stack trace:
!!  #0 /srv/api-platform/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php(228): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->parseDefinition('locale', 'en', '/srv/api-platfo...', Array)
!!  #1 /srv/api-platform/vendor/symfony/dependency-injection/Loader/YamlFileLoader.php(140): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->parseDefinitions(Array, '/srv/api-platfo...')
!!  #2 /srv/api-platform/vendor/symfony/config/Loader/FileLoader.php(159): Symfony\Component\DependencyInjection\Loader\YamlFileLoader->load('/srv/api-platfo...', NULL)
!!  #3 /srv/api-platform in /srv/api-platform/vendor/symfony/config/Loader/FileLoader.php on line 174
!!  
!!  

Installation failed, reverting ./composer.json to its original content.

The contents of etc/container.yaml is:

# Put parameters here that don't need to change on each machine where the app is deployed
# https://symfony.com/doc/current/best_practices/configuration.html#application-related-configuration
parameters:

services:
    locale: 'en'

which is clearly wrong...

Impossible to use "DATABASE_URL" of Doctrine recipe with "PdoSessionHandler"

The DATABASE_URL defined in DoctrineBundle recipe (see https://github.com/symfony/recipes/blob/master/doctrine/doctrine-bundle/1.6/manifest.json#L13) uses DSN syntax, that only Doctrine is able to parse.

This results in inability to use same DATABASE_URL, when configuring PdoSessionHandler class to store sessions in the database.

Possible solutions:

  1. instead of single DSN settings have separate setting for each database connection property (see https://github.com/symfony/symfony-standard/blob/3.3/app/config/parameters.yml.dist#L5-L9)

pros: no code changes needed to make it work
cons: more settings

  1. improve PdoSessionHandler to parse Doctrine-specific DSN

pros: PdoSessionHandler works with Doctrine bundle not installed
cons: code duplication

  1. improve PdoSessionHandler to use Doctrine created connection

pros: you will see DB queries made by PdoSessionHandler in Web Profiler
cons: PdoSessionHandler would depend on DoctrineBundle

Empty encryption in SwiftMailer recipe is not supported by SwiftMailer

I'm upgrading the Symfony Demo app to Flex. After installing SwiftMailer, the following env var is created:

###> symfony/swiftmailer-bundle ###
MAILER_URL=smtp://localhost:25?encryption=&auth_mode=
###< symfony/swiftmailer-bundle ###

However, when running any command console, I see this error:


  [InvalidArgumentException]
  The  encryption is not supported

And the exception trace:

 () at symfony-demo/vendor/symfony/swiftmailer-bundle/DependencyInjection/SwiftmailerTransportFactory.php:146
 Symfony\Bundle\SwiftmailerBundle\DependencyInjection\SwiftmailerTransportFactory::validateConfig() at symfony-demo/vendor/symfony/swiftmailer-bundle/DependencyInjection/SwiftmailerTransportFactory.php:36
 Symfony\Bundle\SwiftmailerBundle\DependencyInjection\SwiftmailerTransportFactory::createTransport() at symfony-demo/var/cache/dev/srcDevDebugProjectContainer.php:3044
 srcDevDebugProjectContainer->getSwiftmailer_Mailer_Default_Transport_DynamicService() at symfony-demo/vendor/symfony/dependency-injection/Container.php:331
 Symfony\Component\DependencyInjection\Container->get() at symfony-demo/vendor/symfony/swiftmailer-bundle/EventListener/EmailSenderListener.php:61
 Symfony\Bundle\SwiftmailerBundle\EventListener\EmailSenderListener->onTerminate() at n/a:n/a
 call_user_func() at symfony-demo/vendor/symfony/event-dispatcher/Debug/WrappedListener.php:104
 Symfony\Component\EventDispatcher\Debug\WrappedListener->__invoke() at n/a:n/a
 call_user_func() at symfony-demo/vendor/symfony/event-dispatcher/EventDispatcher.php:212
 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at symfony-demo/vendor/symfony/event-dispatcher/EventDispatcher.php:44
 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at symfony-demo/vendor/symfony/event-dispatcher/Debug/TraceableEventDispatcher.php:146
 Symfony\Component\EventDispatcher\Debug\TraceableEventDispatcher->dispatch() at symfony-demo/vendor/symfony/console/Application.php:914
 Symfony\Component\Console\Application->doRunCommand() at symfony-demo/vendor/symfony/console/Application.php:223
 Symfony\Component\Console\Application->doRun() at symfony-demo/vendor/symfony/framework-bundle/Console/Application.php:81
 Symfony\Bundle\FrameworkBundle\Console\Application->doRun() at symfony-demo/vendor/symfony/console/Application.php:130
 Symfony\Component\Console\Application->run() at symfony-demo/bin/console:33

Chance to supress a bundle regestration

Hi,
is there a chance to supress a bundle registration of a dependency of my dependencies?
Can i explizit restrict the list of bundle which go into bundles.phpthrough my reciepe?

Background:
My symfony-cmf/seo-bundle requires sonata-project/seo-bundle. Unfortunately they also require their sonata-project/block-bundle, which should be optional, which is registered instead. This bundle, which i don't wanna use requires me to set a default configuration. So i don't whant \Sonata\BlockBundle\SonataBlockBundle not to be registered.

An error during cache warmup displays the message that symfony/console is needed

The cache warmup command currently looks like this in the Makefile:

@test -f bin/console && bin/console cache:warmup || echo "cannot warmup the cache (needs symfony/console)"

The issue with this is that the message will be displayed in 2 cases:

  • when @test fails due to the console not being there (which is the case we want)
  • when the bin/console cache:warmup command fails due to an error if your project

And another effect of this is that make cache-warmup can never fail:

  • without the console, it fails to warmup but still exits with 0
  • in case of warmup failure, it displays the message badly and again exits with 0.

The second case clearly must exit with a failure exit code.
For the first case, I think it should too, but this can be discussed.

Tell the user to go to the created directory after install

$ composer create-project symfony/skeleton:dev-temp flex-demo
 What's next? 
              

  * Run your application:
    1. Execute the make serve command;
    2. Browse to the http://localhost:8000/ URL.

  * Read the documentation at https://symfony.com/doc

The step 1 may confuse users, it will fail if the user doesn't go to the created directory. What about adding something like 1. Enter the flex-demo directory?

Security: Entity provider key not found

Hi, I try to use Guard inside a Flex project and the entity provider tells me that the key couldn't be found inside the security.file, I've checked many times the syntax but the error stays the same :

error

Here's the security.yml file :

security:
    encoders:
        App\Model\User:
            algorithm: bcrypt

    providers:
        api_entity_provider:
            entity:
                class: App\Model\User
                property: apiToken

    firewalls:
        dev:
            pattern: ^/(_(profiler|wdt)|css|images|js)/
            security: false
        main:
            anonymous: null

        api:
            anonymous: ~
            logout: ~
            provider: api_provider
            guard:
                authenticators:
                    - App\Guard\ApiTokenAuthenticator

Note: The error only appear using Flex, I've a classic Sf project along this one on the last version and this last one work.

can not install symfony console

Package operations: 1 install, 0 updates, 0 removals
  - Installing symfony/console (v3.3.9): Loading from cache
Writing lock file
Generating autoload files
Symfony operations: 1 recipe
  - Configuring symfony/console (3.3): From github.com/symfony/recipes:master
Executing script make cache-warmup [KO]
 [KO]
Script make cache-warmup returned with error code 2
!!  
!!  
!!                                                                                 
!!    [Symfony\Component\DependencyInjection\Exception\LogicException]             
!!  
!!    Form support cannot be enabled as the Translation component is not installe  
!!    d.                                                                           
!!                                                                                 
!!  
!!  
!!  make: *** [cache-clear] Error 1
!!  
!!  

Installation failed, reverting ./composer.json to its original content.

Make the config dir easier to override

In symfony/flex#56 there's a proposal to rename etc/ to config/ It has 41 upvotes and 0 downvotes ... but that doesn't mean we'll make that change.

In any case, to make things better for people who really want to use config/ in their apps, why don't we make the config dir easily configurable?

If you review the https://github.com/symfony/recipes/blob/master/symfony/framework-bundle/3.3/src/Kernel.php file, you'll see that etc/ is hardcoded as a string in several methods. Maybe we can introduce a new method similar to getCacheDir() and getLogDir():

    public function getConfigDir(): string
    {
        return dirname(__DIR__).'/etc';
    }

[RFC] Improve the way annotations are enabled

In a Symfony Flex app, I expected to enable annotations by running this:

$ composer require annotations

However, that installs the symfony/annotation-pack, which only installs the low-level libraries needed for annotations (doctrine/cache and doctrine/annotations) but it doesn't really enable annotations in the application.


First, this was a problem because it crashed my browser, as reported here.

Second, even if this comment from config/routing.yaml is perfectly clear:

# Depends on sensio/framework-extra-bundle, doctrine/annotations, and doctrine/cache
#   install with composer req sensio/framework-extra-bundle annot

It's a bit disappointing that composer require annotations doesn't enable annotations and you must also execute composer require sensio/framework-extra-bundle


Solutions:

  • Maybe we should create a better recipe for annotations?
  • Maybe we should add annotations support in frameworkbundle and forget about the framework extra bundle?

api recipe can't be installed due to minimum-stability

Hi,

I would like to use api-platform/api-platform in my flex-enabled symfony application. To do so, I run the following commands:

# creation of the flex-enable symfony application
composer create-project symfony/skeleton:3.3.* sf-flex

# installation of the api recip
composer req api

Unfortunately, I am getting this error message:

[InvalidArgumentException]
Could not find package api-platform/api-pack at any version for your minimum-stability (stable). Check the package spelling or your minimum-stability

require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] []

To avoid that problem, I tried several solutions:

Solution 1

composer create-project symfony/skeleton:3.3.x-dev sf-flex
composer req api

SAME ERROR

Solution 2

composer create-project symfony/skeleton:3.3.x-dev sf-flex # with a newer version of symfony/skeleton
composer req --dev api

SAME ERROR

Solution 3

I tried to update the file composer.lock by changing that field as follows:

    # "minimum-stability": "stable", # has been changed to to dev
    "minimum-stability": "dev",

SAME ERROR

So, any proposal??

Thanks,

Attempt to install "form" recipe results in exception on cache warmup

The default configuration of form recipe has validation enabled and in that case during cache warmup I'm getting this error, when I haven't previously installed validation package:

...
Writing lock file
Generating autoload files
Executing script make cache-warmup [KO]
 [KO]
Script make cache-warmup returned with error code 2
!!  
!!  
!!                                                                      
!!  
!!  
!!    [Symfony\Component\DependencyInjection\Exception\LogicException]  
!!  
!!  
!!    The Validator component is required to use the Form component.    
!!  
!!  
!!                                                                      
!!  
!!  
!!  
!!  
!!  make: *** [cache-clear] Error 1
!!  
!!  

Installation failed, reverting ./composer.json to its original content.

Do we really need a phpunit.xml.dist file?

In the PHPUnitBridge recipe, we have this file: https://github.com/symfony/recipes/blob/master/symfony/phpunit-bridge/3.3/phpunit.xml.dist

I know the theory behind it: we give you a phpunit.xml.dist so you commit it to the repo and then you create a phpunit.xml with your own changes.

Now, my question: is this scenario really that common? In real projects with several developers, do each of them create their own and different phpunit.xml file ... or do they all use the same PHPUnit config file? Should we remote the phpunit.xml.dist file and only use phpunit.xml?

why not let a recipe stays in its package instead of a central place?

the former has a few advantages than the second one

  1. No need to add a version like recipes/symfony/framework-bundle/3.3/. the version here implies us this recipe is valid for >=3.3. I think this is not necessary. the package we declare in composer.json should have valid recipe in it. flex just uses that recipe of that specific version.

  2. According to current design , we have two repositories for recipes, recipes-contrib and recipe repo , once a contributed package released new version, we have to push new PR to recipes-contrib repo, then the manage of recipes-contrib repo needs to merge that PR. this work is also not necessary.

A central place to discover Symfony flex compatible packages is better than central place for recipe, the recipe itself should be maintained by developers of that package, it is born with that package, also fall with that. the NPM and Yarn might be a good example we can follow.

Reconsider the last change about post-install

In 77e841b the way post-install output is defined changed. Instead of post-install-output inside the manifest.json, you now create a post-install.txt file.

I think this is wrong for these reasons:

  1. It's true that the framework-bundle recipe looks ugly ... but that's the absolute edge case of this feature. You would usually display nothing or 1-2 simple lines.

  2. If you make easy to display output ... people will spam the output. We want the opposite; that's why we took some time to hide as much useless Composer output as possible. I fear people will start displaying messages like: "Thanks for using the bundle Acme. Visit our website blah blah" and of course include a lot of useless emojis.

  3. The non-edge case of this feature is to display just 1 or 2 short lines. That's where the previous way (post-install-output in manifest.json) is better than the new proposal (creating a micro-file called post-install.txt)

  4. Managing 1 file with 50 lines is infinitely easier than managing 10 files with 5 lines each. Some developers don't think so and they are afraid of "long files" (anything longer than 10 lines), but that's a fallacy.

Add the "cache" recipe

Right now, when installing symfony/cache package no sample config with sensible defaults is created and I need to go an enable caching manually.

[Doctrine] DATABASE_URL instead of separate DATABASE_* variables less usable

Obviously, having a single database configuration string is much easier for Flex, but makes it harder / more awkward to reuse the environment variables for other purposes, say injecting them to a MySQL Docker container as the required values are embedded inside a Doctrine-specific connection format.

Obviously, I can ship my own database config which gets the job done, but it means the user will have to specify database settings in .env twice which will get confusing.

doctrine/migrations bad namespace

when you use default configuration of migrations bundle, it uses Application\Migrations namespace for migration files.. but new src structure of symfony > 3.3 requires namespace App\Migrations

so i recommend use following cfg of this recipe

// doctrine/doctrine-migrations-bundle/1.2/etc/packages/doctrine_migrations.yaml
doctrine_migrations:
    dir_name: '%kernel.project_dir%/src/Migrations'
    namespace: App\Migrations

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.