les adapter au développement en 2018 Plus facile à apprendre / configurer / utiliser / déployer Framework PHP le plus rapide du marché 10 phpbenchmarks.com
Installing symfony/skeleton (v4.1.5.3) Created project in mydir - Installing symfony/flex (v1.1.1) - ... Generating autoload files Symfony operations: 4 recipes (a4070919102626e6a1736d4d1896e8d8) - Configuring symfony/flex (>=1.0): From github.com/symfony/recipes:master - Configuring symfony/framework-bundle (>=3.3): From github.com/symfony/recipes:master - Configuring symfony/console (>=3.3): From github.com/symfony/recipes:master - Configuring symfony/routing (>=4.0): From github.com/symfony/recipes:master Executing script cache:clear [OK] Executing script assets:install public [OK] Some files may have been created or updated to configure your new packages. Please review, edit and commit them: these files are yours.
dans app/AppKernel.php - Créer la configuration dans app/config/config.yml - Importer le routing dans app/config/routing.yml Installation d’un bundle Avec Flex - composer require bundle 16
to "4.1.*" Using version ^3.3 for symfony/monolog-bundle Restricting packages listed in "symfony/symfony" to "4.1.*" Package operations: 3 installs, 0 updates, 0 removals - Installing monolog/monolog (1.23.0) - Installing symfony/monolog-bridge (v4.1.6) - Installing symfony/monolog-bundle (v3.3.0) Writing lock file Generating autoload files Symfony operations: 1 recipe (3ccbdff84ac79218c4bcf54d45c68b02) - Configuring symfony/monolog-bundle (>=3.1): From github.com/symfony/recipes:master Executing script cache:clear [OK] Executing script assets:install public [OK] Some files may have been created or updated to configure your new packages. Please review, edit and commit them: these files are yours.
to "4.1.*" Using version ^3.3 for symfony/monolog-bundle Restricting packages listed in "symfony/symfony" to "4.1.*" Package operations: 3 installs, 0 updates, 0 removals - Installing monolog/monolog (1.23.0) - Installing symfony/monolog-bridge (v4.1.6) - Installing symfony/monolog-bundle (v3.3.0) Writing lock file Generating autoload files Symfony operations: 1 recipe (3ccbdff84ac79218c4bcf54d45c68b02) - Configuring symfony/monolog-bundle (>=3.1): From github.com/symfony/recipes:master Executing script cache:clear [OK] Executing script assets:install public [OK] Some files may have been created or updated to configure your new packages. Please review, edit and commit them: these files are yours.
27 Un recette peut : - ajouter des variables d’env - ajouter des paramètres de container - ajouter des fichiers/dossiers au gitignore - créer des fichiers de configuration - enregistrer des bundles
~/mydir bin/console make:controller Choose a name for your controller class (e.g. OrangeJellybeanController): > HomeController created: src/Controller/HomeController.php _Success!_ Next: Open your new controller class and add some pages! Nécessaire pour maker:controller
.cleanupOutputBeforeBuild() .enableBuildNotifications() .enableSourceMaps(!Encore.isProduction()) .enableVersioning(Encore.isProduction()) // enables Sass/SCSS support //.enableSassLoader() // uncomment if you use TypeScript //.enableTypeScriptLoader() // uncomment if you're having problems with a jQuery plugin //.autoProvidejQuery()
... */} class Mailer {/* ... */} class RegistrationManager { private $persister; private $mailer; public function __construct( Persister $persister, Mailer $mailer ) { /* ... */ } public function register() {} } Objectif : $manager = new RegistrationManager( new Persister($doctrine), new Mailer($twig, $swiftmailer) );
... */} class Mailer {/* ... */} class RegistrationManager { private $persister; private $mailer; public function __construct(Persister $persister, Mailer $mailer) { /* ... */ } public function register() {} } Nom des services à injecter = typehints
$projectDir: '%kernel.project_dir%' # pour tous les services du fichier _defaults: bind: $projectDir: '%kernel.project_dir%' Automatise l’injection des paramètres