From 57918e4e30533a2b75ee0d8950b84398f1c1228b Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sun, 22 Oct 2017 19:30:15 -0400 Subject: [PATCH 1/6] WIP --- setup.rst | 107 ++++++++++++++++++++++++++---------------------------- 1 file changed, 52 insertions(+), 55 deletions(-) diff --git a/setup.rst b/setup.rst index 5d295693395..8a5d2260020 100644 --- a/setup.rst +++ b/setup.rst @@ -4,99 +4,96 @@ Installing & Setting up the Symfony Framework ============================================= -This article explains how to install Symfony and solve the most common issues -that may appear during the installation process. - .. seealso:: Do you prefer video tutorials? Check out the `Joyful Development with Symfony`_ screencast series from KnpUniversity. -.. _installation-creating-the-app: - -Creating Symfony Applications ------------------------------ - -Symfony applications are created with `Composer`_, the package manager used by -modern PHP applications. If you don't have Composer installed in your computer, -start by :doc:`installing Composer globally `. Then, execute -this command to create a new empty Symfony application based on its latest -stable version: +To create your new Symfony application, first make sure you're using PHP 7.1 or higher +and have `Composer`_ installed. If you don't, start by :doc:`installing Composer globally ` +on your system. Then, create a new project by running: .. code-block:: terminal $ composer create-project symfony/skeleton my-project +This will create a new ``my-project`` directory, download some dependencies into +it and even generate the basic directories and files you'll need to get started. +In other words, your new app is ready! + .. tip:: - If your Internet connection is slow, you may think that Composer is not - doing anything. If that's your case, add the ``-vvv`` flag to the previous - command to display a detailed output of everything that Composer is doing. + You can also download a specific version of Symfony: -If your project needs to be based on a specific Symfony version, use the -optional third argument of the ``create-project`` command: + .. code-block:: terminal -.. code-block:: terminal + # use the most recent version in any Symfony branch + $ composer create-project symfony/skeleton my-project "3.3.*" - # use the most recent version in any Symfony branch - $ composer create-project symfony/skeleton my-project "3.3.*" + # use a beta or RC version (useful for testing new Symfony versions) + $ composer create-project symfony/skeleton my-project 3.3.0-BETA1 - # use a specific Symfony version - $ composer create-project symfony/skeleton my-project "3.3.5" + Some version are long-term support (LTS) versions. Read the :doc:`Symfony Release process ` + to learn more. - # use a beta or RC version (useful for testing new Symfony versions) - $ composer create-project symfony/skeleton my-project 3.3.0-BETA1 +Running your Symfony Application +-------------------------------- -.. note:: +On production, you should use a web server like Nginx or Apache +(see :doc:`configuring a web server to run Symfony `). +But for development, it's even easier to use the Symfony PHP web server. - Read the :doc:`Symfony Release process ` - to better understand why there are several Symfony versions and which one - to use for your projects. +First, move into your new project and install the server: -Running the Symfony Application -------------------------------- +.. code-block:: terminal -On production servers, Symfony applications use web servers such as Apache or -Nginx (see :doc:`configuring a web server to run Symfony `). -However, on your local development machine you can also use the web server -provided by Symfony, which in turn uses the built-in web server provided by PHP. + cd my-project + composer require server -First, :doc:`install the Symfony Web Server ` and -then, execute this command: +To start the server, run: .. code-block:: terminal $ php bin/console server:run -Open your browser, access the ``http://localhost:8000/`` URL and you'll see the -application running. When you are finished working on your Symfony application, -stop the server by pressing ``Ctrl+C`` from the terminal or command console. +Open your browser and navigate to ``http://localhost:8000/``. If everything is working, +you'll see a welcome page. Later, when you are finished working, stop the server +by pressing ``Ctrl+C`` from your terminal. .. tip:: - Symfony's web server is great for developing, but should **not** be - used on production. Instead, use Apache or Nginx. - See :doc:`/setup/web_server_configuration`. + If you're using a VM, you may need to tell the server to bind to all IP addresses: -Checking Symfony Requirements ------------------------------ + .. code-block:: terminal -In addition to PHP 7.1, Symfony has other `technical requirements`_ that your -server must meet. Symfony provides a tool called "Requirements Checker" (or -``req-checker``) to check those requirements: + $ php bin/console server:start 0.0.0.0:8000 + + You should **NEVER** listen to all interfaces on a computer that is + directly accessible from the Internet. + +Troubleshooting: The Requirements Checker +----------------------------------------- + +If you're having any problems running Symfony, your system may be missing some +`technical requirements`_. Symfony has a "Requirements Checker" tool that you +can use to easily make sure your system is set up. First, move into your project +directory and install it: .. code-block:: terminal - $ cd my-project/ $ composer require req-checker -The ``req-checker`` utility adds two PHP scripts in your application: -``bin/check.php`` and ``public/check.php``. Run the first one in the command -console and the second one in the browser. This is needed because PHP can define -a different configuration for both the command console and the web server, so -you need to check both. +The ``req-checker`` utility adds two PHP scripts to your application: +``bin/check.php`` and ``public/check.php``. Run the first one from your terminal: + +.. code-block:: terminal + + php bin/check.php + +This will check your CLI environment. Run the second one from a browser (e.g. +``http://localhost:8000/check.php``) to check your web server environment. -Once you've fixed all the reported issues, uninstall the requirements checker: +Once you've fixed any issues, uninstall the requirements checker: .. code-block:: terminal From efb7b50984a0fba3c896e0b9b580e3e50c58331a Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 24 Oct 2017 09:00:11 -0400 Subject: [PATCH 2/6] updating page_creation and setup for 4.0 --- page_creation.rst | 232 +++++++++++++++++++++++++++++----------------- setup.rst | 72 +++++--------- 2 files changed, 170 insertions(+), 134 deletions(-) diff --git a/page_creation.rst b/page_creation.rst index 06fbdb00df0..c80ef5b23cd 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -41,21 +41,16 @@ Creating a Page: Route and Controller Suppose you want to create a page - ``/lucky/number`` - that generates a lucky (well, random) number and prints it. To do that, create a "Controller class" and a -"controller" method inside of it that will be executed when someone goes to -``/lucky/number``:: +"controller" method inside of it:: - // src/AppBundle/Controller/LuckyController.php - namespace AppBundle\Controller; + // src/Controller/LuckyController.php + namespace App\Controller; use Symfony\Component\HttpFoundation\Response; - use Symfony\Component\Routing\Annotation\Route; class LuckyController { - /** - * @Route("/lucky/number") - */ - public function numberAction() + public function number() { $number = mt_rand(0, 100); @@ -65,8 +60,18 @@ random) number and prints it. To do that, create a "Controller class" and a } } -Before diving into this, test it out! If you are using PHP's internal web server -go to: +To map a URL to this controller, create a route in ``config/routes.yaml``: + +.. code-block:: yml + + # config/routes.yaml + + # the "app_lucky_number" route name is not important yet + app_lucky_number: + path: /lucky/number + controller: App\Controller\LuckyController::number + +That's it! If you are using Symfony web server, try it out by going to: http://localhost:8000/lucky/number @@ -74,35 +79,135 @@ If you see a lucky number being printed back to you, congratulations! But before you run off to play the lottery, check out how this works. Remember the two steps to creating a page? -#. *Create a route*: The ``@Route`` above ``numberAction()`` is the *route*: it - defines the URL pattern for this page. You'll learn more about :doc:`routing ` - in its own section, including how to make *variable* URLs; +#. *Create a route*: In ``config/routes.yaml``, the route defines the URL to your + page (``path``) and what ``controller`` to call. You'll learn more about :doc:`routing ` + in its own section, including how to make *variable* URLs; -#. *Create a controller*: The method below the route - ``numberAction()`` - is called - the *controller*. This is a function where *you* build the page and ultimately +#. *Create a controller*: This is a function where *you* build the page and ultimately return a ``Response`` object. You'll learn more about :doc:`controllers ` in their own section, including how to return JSON responses. +Annotation Routes +----------------- + +Instead of defining your route in YAML, Symfony also allows you to use *annotation* +routes. First, install the annotations package: + +.. code-block:: terminal + + $ composer require annotations + +Then, in ``config/routes.yaml``, remove the route we just created and uncomment +the annotation route import at the bottom: + +.. code-block:: yaml + + controllers: + resource: ../src/Controller/ + type: annotation + +After this one-time setup, you can nowadd your route directly *above* the controller: + +.. code-block:: diff + + // src/Controller/LuckyController.php + // ... + + + use Symfony\Component\Routing\Annotation\Route; + + + /** + + * @Route("/lucky/number") + + */ + class LuckyController + { + public function number() + { + // this looks exactly the same + } + } + +That's it! The page - ``http://localhost:8000/lucky/number`` will work exactly +like before! Annotations are the recommended way to configure routes. + +Auto-Installing Recipes with Symfony Flex +----------------------------------------- + +You may not have noticed, but when you ran ``composer require annotations``, two +special things happened, both thanks to a powerful Composer plugin called +:doc:`Flex `. + +First, ``annotations`` isn't a real package name: it's an *alias* (i.e. shortcut) +that Flex resolves to ``sensio/framework-extra-bundle``. + +Second, after this package was downloaded, Flex executed a *recipe*, which automatically +enabled the bundle. Flex recipes exist for many packages (not just bundles) and have +have the ability to do a lot, like adding configuration files, creating directories, +updating ``.gitignore`` and adding new config to your ``.env`` file. Flex *automates* +the installation of packages so you can get back to coding. + +You can learn more about Flex by reading ":doc:`/setup/flex`". But that's not necessary: +Flex works automatically in the background when you add packages. + +The bin/console Utility +----------------------- + +Your project already has a powerful debugging tool inside: the ``bin/console`` command. +Try running it: + +.. code-block:: terminal + + php bin/console + +You should see a list of commands that can give you debugging information, help generate +code, generate database migrations and a lot more. As you install more packages, +you'll see more commands. + +To get a list of *all* of the routes in your system, use the ``debug:router`` command: + +.. code-block:: terminal + + php bin/console debug:router + +You'll learn about many more commands as you continue! + The Web Debug Toolbar: Debugging Dream -------------------------------------- -If your page is working, then you should *also* see a bar along the bottom of your -browser. This is called the Web Debug Toolbar: and it's your debugging best friend. -You'll learn more about all the information it holds along the way, but feel free -to experiment: hover over and click the different icons to get information about -routing, performance, logging and more. +One of Symfony's *killer* features is the Web Debug Toolbar: a bar that displays +a *huge* amount of debugging information along the bottom of your page while developing. + +To use the web debug toolbar, just install it: -Rendering a Template (with the Service Container) -------------------------------------------------- +.. code-block:: terminal + + $ composer require profiler + +As soon as this finishes, refresh your page. You should see a black bar along the +bottom of the page. You'll learn more about all the information it holds along the +way, but feel free to experiment: hover over and click the different icons to get +information about routing, performance, logging and more. + +The ``profiler`` package is also a great example of Flex! After downloading the +package, the recipe created several configuration files so that the web debug toolbar +worked instantly. + +Rendering a Template +-------------------- If you're returning HTML from your controller, you'll probably want to render a template. Fortunately, Symfony comes with `Twig`_: a templating language that's easy, powerful and actually quite fun. -First, make sure that ``LuckyController`` extends Symfony's base +First, install Twig:: + +.. code-block:: terminal + + $ composer require twig + +Second, make sure that ``LuckyController`` extends Symfony's base :class:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller` class:: - // src/AppBundle/Controller/LuckyController.php + // src/Controller/LuckyController.php // ... // --> add this new use statement @@ -113,10 +218,10 @@ First, make sure that ``LuckyController`` extends Symfony's base // ... } -Now, use the handy ``render()`` function to render a template. Pass it our ``number`` -variable so we can render that:: +Now, use the handy ``render()`` function to render a template. Pass it a ``number`` +variable so you can use it in Twig:: - // src/AppBundle/Controller/LuckyController.php + // src/Controller/LuckyController.php // ... class LuckyController extends Controller @@ -124,7 +229,7 @@ variable so we can render that:: /** * @Route("/lucky/number") */ - public function numberAction() + public function number() { $number = mt_rand(0, 100); @@ -134,13 +239,13 @@ variable so we can render that:: } } -Finally, template files should live in the ``app/Resources/views`` directory. Create -a new ``app/Resources/views/lucky`` directory with a new ``number.html.twig`` file -inside: +Template files live in the ``templates/`` directory, which was created for your automatically +when you installed Twig. Create a new ``templates/lucky`` directory with a new +``number.html.twig`` file inside: .. code-block:: twig - {# app/Resources/views/lucky/number.html.twig #} + {# templates/lucky/number.html.twig #}

Your lucky number is {{ number }}

@@ -155,17 +260,17 @@ other templates and leverage its powerful layout inheritance system. Checking out the Project Structure ---------------------------------- -Great news! You've already worked inside the two most important directories in your +Great news! You've already worked inside the most important directories in your project: -``app/`` - Contains things like configuration and templates. Basically, anything - that is *not* PHP code goes here. +``config/`` + Contains... configuration of course!. You will configure routes, :doc:`services ` + and pckages. ``src/`` - Your PHP code lives here. + All your PHP code lives here. -99% of the time, you'll be working in ``src/`` (PHP files) or ``app/`` (everything +99% of the time, you'll be working in ``src/`` (PHP files) or ``config/`` (everything else). As you keep reading, you'll learn what can be done inside each of these. So what about the other directories in the project? @@ -174,58 +279,17 @@ So what about the other directories in the project? The famous ``bin/console`` file lives here (and other, less important executable files). -``tests/`` - The automated tests (e.g. Unit tests) for your application live here. - ``var/`` This is where automatically-created files are stored, like cache files - (``var/cache/``), logs (``var/log/``) and sessions (``var/sessions/``). + (``var/cache/``) and logs (``var/log/``). ``vendor/`` Third-party (i.e. "vendor") libraries live here! These are downloaded via the `Composer`_ package manager. -``web/`` - This is the document root for your project: put any publicly accessible files - here (e.g. CSS, JS and images). - -Bundles & Configuration ------------------------ - -Your Symfony application comes pre-installed with a collection of *bundles*, like -``FrameworkBundle`` and ``TwigBundle``. Bundles are similar to the idea of a *plugin*, -but with one important difference: *all* functionality in a Symfony application comes -from a bundle. - -Bundles are registered in your ``app/AppKernel.php`` file (a rare PHP file in the -``app/`` directory) and each gives you more *tools*, sometimes called *services*:: - - class AppKernel extends Kernel - { - public function registerBundles() - { - $bundles = array( - new Symfony\Bundle\FrameworkBundle\FrameworkBundle(), - new Symfony\Bundle\TwigBundle\TwigBundle(), - // ... - ); - // ... - - return $bundles; - } - - // ... - } - -For example, ``TwigBundle`` is responsible for adding the Twig tool to your app! - -Eventually, you'll download and add more third-party bundles to your app in order -to get even more tools. Imagine a bundle that helps you create paginated lists. -That exists! - -You can control how your bundles behave via the ``app/config/config.yml`` file. -That file - and other details like environments & parameters - are discussed in -the :doc:`/configuration` article. +``public/`` + This is the document root for your project: you put any publicly accessible files + here. What's Next? ------------ diff --git a/setup.rst b/setup.rst index 8a5d2260020..edfb12ffc03 100644 --- a/setup.rst +++ b/setup.rst @@ -11,7 +11,9 @@ Installing & Setting up the Symfony Framework To create your new Symfony application, first make sure you're using PHP 7.1 or higher and have `Composer`_ installed. If you don't, start by :doc:`installing Composer globally ` -on your system. Then, create a new project by running: +on your system. If you want to use a virtual machine (VM), check out :doc:`Homestead `. + +Create your new project by running: .. code-block:: terminal @@ -41,7 +43,7 @@ Running your Symfony Application On production, you should use a web server like Nginx or Apache (see :doc:`configuring a web server to run Symfony `). -But for development, it's even easier to use the Symfony PHP web server. +But for development, it's even easier to use the :doc:`Symfony PHP web server `. First, move into your new project and install the server: @@ -99,37 +101,14 @@ Once you've fixed any issues, uninstall the requirements checker: $ composer remove req-checker -.. _installation-updating-vendors: - -Updating Symfony Applications ------------------------------ - -At this point, you've created a fully-functional Symfony application! Every -Symfony app depends on a number of third-party libraries stored in the -``vendor/`` directory and managed by Composer. - -Updating those libraries frequently is a good practice to fix bugs and prevent -security vulnerabilities. Execute the ``update`` Composer command to update them -all at once (this can take up to several minutes to complete depending on the -complexity of your project): - -.. code-block:: terminal - - $ cd my_project_name/ - $ composer update - .. _install-existing-app: -Installing an Existing Symfony Application ------------------------------------------- - -When working collaboratively in a Symfony application, it's uncommon to create -a new Symfony application as explained in the previous sections. Instead, -someone else has already created and submitted it to a shared repository. +Setting up an Existing Symfony Project +-------------------------------------- -It's recommended to not submit some files (``.env``) and directories (``vendor/``, -cache, logs) to the repository, so you'll have to do the following when -installing an existing Symfony application: +If you're working on an existing Symfony application, you'll just need to do a few +things to get your project setup. Assuming your team uses git, you can setup your +project with the following commands: .. code-block:: terminal @@ -141,10 +120,13 @@ installing an existing Symfony application: $ cd my-project/ $ composer install +You'll probably also need to customize your :ref:`.env ` and do a +few other project-specific tasks (e.g. creating database schema). + Checking for Security Vulnerabilities ------------------------------------- -Symfony provides a utility called "Security Checker" (or ``sec-checker``) to +Symfony provides a utility called the "Security Checker" (or ``sec-checker``) to check whether your project's dependencies contain any known security vulnerability. Run this command to install it in your application: @@ -153,32 +135,21 @@ vulnerability. Run this command to install it in your application: $ cd my-project/ $ composer require sec-checker -From now on, this command will be run automatically whenever you install or -update any dependency in the application. +From now on, this utility will be run automatically whenever you install or +update any dependency in the application. If a dependency contains a vulnerability, +you'll see a clear message. -Installing the Symfony Demo application ---------------------------------------- +The Symfony Demo application +---------------------------- `The Symfony Demo Application`_ is a fully-functional application that shows the recommended way to develop Symfony applications. It's a great learning tool for Symfony newcomers and its code contains tons of comments and helpful notes. -Run the following command to download and install the Symfony Demo application: - -.. code-block:: terminal - - $ composer create-project symfony/symfony-demo my-project - -Now, enter the ``my-project/`` directory, run the internal web server and -browse ``http://127.0.0.1:8000``: - -.. code-block:: terminal - - $ cd my-project - $ php bin/console server:start +To check out its code and install it locally, see `symfony/symfony-demo`_. -Keep Going! ------------ +Start Coding! +------------- With setup behind you, it's time to :doc:`Create your first page in Symfony `. @@ -205,3 +176,4 @@ Go Deeper with Setup .. _`Composer`: https://getcomposer.org/ .. _`technical requirements`: https://symfony.com/doc/current/reference/requirements.html .. _`The Symfony Demo application`: https://github.com/symfony/symfony-demo +.. _`symfony/symfony-demo`: https://github.com/symfony/demo From 5cd1e20f8415b3e82d9b8c0a03875de93471f067 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 24 Oct 2017 09:30:15 -0400 Subject: [PATCH 3/6] Changes thanks to Javier --- page_creation.rst | 21 ++++++++++++--------- setup.rst | 2 +- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/page_creation.rst b/page_creation.rst index c80ef5b23cd..e436e33f0d1 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -60,7 +60,9 @@ random) number and prints it. To do that, create a "Controller class" and a } } -To map a URL to this controller, create a route in ``config/routes.yaml``: +Now you need to associate this controller function with a public URL (e.g. ``/lucky/number``) +so that the ``number()`` method is executed when a user browses to it. This association +is defined by creating a **route** in the ``config/routes.yaml`` file: .. code-block:: yml @@ -106,7 +108,7 @@ the annotation route import at the bottom: resource: ../src/Controller/ type: annotation -After this one-time setup, you can nowadd your route directly *above* the controller: +After this one-time setup, you can now add your route directly *above* the controller: .. code-block:: diff @@ -139,11 +141,12 @@ special things happened, both thanks to a powerful Composer plugin called First, ``annotations`` isn't a real package name: it's an *alias* (i.e. shortcut) that Flex resolves to ``sensio/framework-extra-bundle``. -Second, after this package was downloaded, Flex executed a *recipe*, which automatically -enabled the bundle. Flex recipes exist for many packages (not just bundles) and have -have the ability to do a lot, like adding configuration files, creating directories, -updating ``.gitignore`` and adding new config to your ``.env`` file. Flex *automates* -the installation of packages so you can get back to coding. +Second, after this package was downloaded, Flex executed a *recipe*, which is a +set of automated instructions that tell Symfony how to integrate an external +package. Flex recipes exist for many packages (not just bundles) and have the +ability to do a lot, like adding configuration files, creating directories, +updating ``.gitignore`` and adding new config to your ``.env`` file. Flex +*automates* the installation of packages so you can get back to coding. You can learn more about Flex by reading ":doc:`/setup/flex`". But that's not necessary: Flex works automatically in the background when you add packages. @@ -239,7 +242,7 @@ variable so you can use it in Twig:: } } -Template files live in the ``templates/`` directory, which was created for your automatically +Template files live in the ``templates/`` directory, which was created for you automatically when you installed Twig. Create a new ``templates/lucky`` directory with a new ``number.html.twig`` file inside: @@ -265,7 +268,7 @@ project: ``config/`` Contains... configuration of course!. You will configure routes, :doc:`services ` - and pckages. + and packages. ``src/`` All your PHP code lives here. diff --git a/setup.rst b/setup.rst index edfb12ffc03..9debd159aad 100644 --- a/setup.rst +++ b/setup.rst @@ -107,7 +107,7 @@ Setting up an Existing Symfony Project -------------------------------------- If you're working on an existing Symfony application, you'll just need to do a few -things to get your project setup. Assuming your team uses git, you can setup your +things to get your project setup. Assuming your team uses Git, you can setup your project with the following commands: .. code-block:: terminal From f727f17984e302efc4fd80fd0b0e0e9e15b6907f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 24 Oct 2017 09:38:05 -0400 Subject: [PATCH 4/6] Fixing build issues --- configuration.rst | 9 +++++++++ configuration/micro_kernel_trait.rst | 2 +- page_creation.rst | 2 +- setup/_vendor_deps.rst.inc | 3 +-- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/configuration.rst b/configuration.rst index e6a4358210a..1b120db7e1a 100644 --- a/configuration.rst +++ b/configuration.rst @@ -295,6 +295,15 @@ signs - e.g. ``%locale%``. For more information about parameters - including how to reference them from inside a controller - see :ref:`service-container-parameters`. +.. _config-dot-env: + +The .env File +~~~~~~~~~~~~~ + +There is also a ``.env`` file which is loaded. Its contents become environment variables +in the dev environment, making it easier to reference environment variables in your +code. + .. _config-parameters-yml: The Special parameters.yml File diff --git a/configuration/micro_kernel_trait.rst b/configuration/micro_kernel_trait.rst index 3bceafc99ff..8e834079271 100644 --- a/configuration/micro_kernel_trait.rst +++ b/configuration/micro_kernel_trait.rst @@ -1,7 +1,7 @@ Building your own Framework with the MicroKernelTrait ===================================================== -A :ref:`traditional Symfony app ` contains a sensible +A traditional Symfony app contains a sensible directory structure, various configuration files and an ``AppKernel`` with several bundles already-registered. This is a fully-featured app that's ready to go. diff --git a/page_creation.rst b/page_creation.rst index e436e33f0d1..3e538a5ecfa 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -64,7 +64,7 @@ Now you need to associate this controller function with a public URL (e.g. ``/lu so that the ``number()`` method is executed when a user browses to it. This association is defined by creating a **route** in the ``config/routes.yaml`` file: -.. code-block:: yml +.. code-block:: yaml # config/routes.yaml diff --git a/setup/_vendor_deps.rst.inc b/setup/_vendor_deps.rst.inc index bbb4ec1f20b..420c9b2081b 100644 --- a/setup/_vendor_deps.rst.inc +++ b/setup/_vendor_deps.rst.inc @@ -11,8 +11,7 @@ you need for each. By default, these libraries are downloaded by running a ``composer install`` "downloader" binary. This ``composer`` file is from a library called `Composer`_ -and you can read more about installing it in the :ref:`Installation ` -article. +and you can read more about :doc:`installing Composer globally `. The ``composer`` command reads from the ``composer.json`` file at the root of your project. This is an JSON-formatted file, which holds a list of each From 771f41c1c973462456b2ab1b6ea416061272877d Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Tue, 24 Oct 2017 10:13:48 -0400 Subject: [PATCH 5/6] last tweaks --- page_creation.rst | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/page_creation.rst b/page_creation.rst index 3e538a5ecfa..9d1dd3bab48 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -143,10 +143,10 @@ that Flex resolves to ``sensio/framework-extra-bundle``. Second, after this package was downloaded, Flex executed a *recipe*, which is a set of automated instructions that tell Symfony how to integrate an external -package. Flex recipes exist for many packages (not just bundles) and have the -ability to do a lot, like adding configuration files, creating directories, -updating ``.gitignore`` and adding new config to your ``.env`` file. Flex -*automates* the installation of packages so you can get back to coding. +package. Flex recipes exist for many packages and have the ability to do a lot, like +adding configuration files, creating directories, updating ``.gitignore`` and adding +new config to your ``.env`` file. Flex *automates* the installation of packages so +you can get back to coding. You can learn more about Flex by reading ":doc:`/setup/flex`". But that's not necessary: Flex works automatically in the background when you add packages. From 17d1a108a9b57e4f6a165e5c02fe5692133e88bd Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Sat, 28 Oct 2017 22:19:31 -0400 Subject: [PATCH 6/6] Fixes thanks to Wouter --- page_creation.rst | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/page_creation.rst b/page_creation.rst index 9d1dd3bab48..2889e2b0b49 100644 --- a/page_creation.rst +++ b/page_creation.rst @@ -99,7 +99,7 @@ routes. First, install the annotations package: $ composer require annotations -Then, in ``config/routes.yaml``, remove the route we just created and uncomment +Then, in ``config/routes.yaml``, remove the route you just created and uncomment the annotation route import at the bottom: .. code-block:: yaml @@ -113,8 +113,8 @@ After this one-time setup, you can now add your route directly *above* the contr .. code-block:: diff // src/Controller/LuckyController.php - // ... + // ... + use Symfony\Component\Routing\Annotation\Route; + /** @@ -143,15 +143,15 @@ that Flex resolves to ``sensio/framework-extra-bundle``. Second, after this package was downloaded, Flex executed a *recipe*, which is a set of automated instructions that tell Symfony how to integrate an external -package. Flex recipes exist for many packages and have the ability to do a lot, like -adding configuration files, creating directories, updating ``.gitignore`` and adding -new config to your ``.env`` file. Flex *automates* the installation of packages so -you can get back to coding. +package. Flex recipes exist for many packages (see `symfony.sh`_) and have the ability +to do a lot, like adding configuration files, creating directories, updating ``.gitignore`` +and adding new config to your ``.env`` file. Flex *automates* the installation of +packages so you can get back to coding. You can learn more about Flex by reading ":doc:`/setup/flex`". But that's not necessary: Flex works automatically in the background when you add packages. -The bin/console Utility +The bin/console Command ----------------------- Your project already has a powerful debugging tool inside: the ``bin/console`` command. @@ -159,7 +159,7 @@ Try running it: .. code-block:: terminal - php bin/console + $ php bin/console You should see a list of commands that can give you debugging information, help generate code, generate database migrations and a lot more. As you install more packages, @@ -169,7 +169,7 @@ To get a list of *all* of the routes in your system, use the ``debug:router`` co .. code-block:: terminal - php bin/console debug:router + $ php bin/console debug:router You'll learn about many more commands as you continue! @@ -331,3 +331,4 @@ Go Deeper with HTTP & Framework Fundamentals .. _`Twig`: http://twig.sensiolabs.org .. _`Composer`: https://getcomposer.org .. _`Joyful Development with Symfony`: http://knpuniversity.com/screencast/symfony/first-page +.. _`symfony.sh`: https://symfony.sh/