From 2d5055077dce4f2c5c282d3daaf0baf3389f4f95 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 18 May 2017 09:36:41 +0200 Subject: [PATCH 1/8] minor #7914 Fix a typo (GuilhemN) This PR was merged into the master branch. Discussion ---------- Fix a typo Commits ------- f5e9e6b typo --- _exts | 1 + 1 file changed, 1 insertion(+) create mode 160000 _exts diff --git a/_exts b/_exts new file mode 160000 index 00000000000..52f7bd2216c --- /dev/null +++ b/_exts @@ -0,0 +1 @@ +Subproject commit 52f7bd2216cc22ef52494f346c5643bb2a74513f From 4283d7a210b9b91bcc53879f95595aac1b05f81c Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 18 May 2017 10:08:46 +0200 Subject: [PATCH 2/8] Revert "minor #7914 Fix a typo (GuilhemN)" This reverts commit 2d5055077dce4f2c5c282d3daaf0baf3389f4f95. --- _exts | 1 - 1 file changed, 1 deletion(-) delete mode 160000 _exts diff --git a/_exts b/_exts deleted file mode 160000 index 52f7bd2216c..00000000000 --- a/_exts +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 52f7bd2216cc22ef52494f346c5643bb2a74513f From bd5d036313917df4e5062a69072a76bdcc5b089c Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 12 Jun 2017 21:59:29 +0200 Subject: [PATCH 3/8] Update example comment to remove unnecessary text --- frontend/encore/simple-example.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/encore/simple-example.rst b/frontend/encore/simple-example.rst index 65ee0891107..137b6b34b31 100644 --- a/frontend/encore/simple-example.rst +++ b/frontend/encore/simple-example.rst @@ -22,7 +22,7 @@ Inside, use Encore to help generate your Webpack configuration. var Encore = require('@symfony/webpack-encore'); Encore - // directory where should all compiled assets will be stored + // directory where all compiled assets will be stored .setOutputPath('web/build/') // what's the public path to this directory (relative to your project's document root dir) From 49e24b9fea97c8ac105915c34efdcb34a9d75b63 Mon Sep 17 00:00:00 2001 From: Fabien Bourigault Date: Wed, 14 Jun 2017 15:25:56 +0200 Subject: [PATCH 4/8] remove debugging class cache and bootstrap section --- debug/debugging.rst | 47 --------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/debug/debugging.rst b/debug/debugging.rst index 2bb3a585830..a633ef7872c 100644 --- a/debug/debugging.rst +++ b/debug/debugging.rst @@ -14,53 +14,6 @@ configuration is optimized for two main purposes: * Be as similar as possible as the production environment to avoid problems when deploying the project. -Disabling the Bootstrap File and Class Caching ----------------------------------------------- - -And to make the production environment as fast as possible, Symfony creates -big PHP files in your cache containing the aggregation of PHP classes your -project needs for every request. However, this behavior can confuse your debugger, -because the same class can be located in two different places: the original class -file and the big file which aggregates lots of classes. - -This recipe shows you how you can tweak this caching mechanism to make it friendlier -when you need to debug code that involves Symfony classes. - -The ``app_dev.php`` front controller reads as follows by default:: - - // ... - - $loader = require __DIR__.'/../app/autoload.php'; - Debug::enable(); - - $kernel = new AppKernel('dev', true); - $kernel->loadClassCache(); - $request = Request::createFromGlobals(); - // ... - -To make your debugger happier, disable the loading of all PHP class caches -by removing the call to ``loadClassCache()``:: - - // ... - - $loader = require_once __DIR__.'/../app/autoload.php'; - Debug::enable(); - - $kernel = new AppKernel('dev', true); - // $kernel->loadClassCache(); - $request = Request::createFromGlobals(); - -.. tip:: - - If you disable the PHP caches, don't forget to revert after your debugging - session. - -Some IDEs do not like the fact that some classes are stored in different -locations. To avoid problems, you can either tell your IDE to ignore the PHP -cache files, or you can change the extension used by Symfony for these files:: - - $kernel->loadClassCache('classes', '.php.cache'); - Useful Debugging Commands ------------------------- From 4b2113349c9f67e7569f684edcb6c991249684a6 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Sat, 24 Jun 2017 12:50:00 +0100 Subject: [PATCH 5/8] [Stopwatch] Document the reset method --- components/stopwatch.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/stopwatch.rst b/components/stopwatch.rst index d2791f5bbb5..3d1d02c68c9 100644 --- a/components/stopwatch.rst +++ b/components/stopwatch.rst @@ -41,6 +41,10 @@ from the :method:`Symfony\\Component\\Stopwatch\\Stopwatch::start`, The latter should be used when you need to retrieve the duration of an event while it is still running. +The stopwatch can be reset to its original state at any given time with the +:method:`Symfony\\Component\\Stopwatch\\Stopwatch::reset` method, which deletes +all the data measured so far. + You can also provide a category name to an event:: $stopwatch->start('eventName', 'categoryName'); From 2565b476ab2a68d65e170f8aa0bcd47f531dfbaa Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sun, 9 Jul 2017 11:22:39 +0200 Subject: [PATCH 6/8] Updated the installation instructions for Symfony 4 --- setup.rst | 295 +++++++++++++++++------------------------------------- 1 file changed, 92 insertions(+), 203 deletions(-) diff --git a/setup.rst b/setup.rst index 51c20a9a0c8..47025d249a5 100644 --- a/setup.rst +++ b/setup.rst @@ -4,121 +4,48 @@ Installing & Setting up the Symfony Framework ============================================= -This article explains how to install Symfony in different ways and how to solve -the most common issues that may appear during the installation process. +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 provides a dedicated application called the **Symfony Installer** to ease -the creation of Symfony applications. This installer is a PHP 5.4 compatible -executable that needs to be installed on your system only once: - -.. code-block:: terminal - - # Linux and macOS systems - $ sudo mkdir -p /usr/local/bin - $ sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony - $ sudo chmod a+x /usr/local/bin/symfony - - # Windows systems - c:\> php -r "file_put_contents('symfony', file_get_contents('https://symfony.com/installer'));" - -.. note:: - - In Linux and macOS, a global ``symfony`` command is created. In Windows, - move the ``symfony`` file to a directory that's included in the ``PATH`` - environment variable and create a ``symfony.bat`` file to create the global - command or move it to any other directory convenient for you: - - .. code-block:: terminal - - # for example, if WAMP is used ... - c:\> move symfony c:\wamp\bin\php - # create symfony.bat in the same folder - c:\> cd c:\wamp\bin\php - c:\> (echo @ECHO OFF & echo php "%~dp0symfony" %*) > symfony.bat - # ... then, execute the command as: - c:\> symfony - - # moving it to your projects folder ... - c:\> move symfony c:\projects - # ... then, execute the command as - c:\> cd projects - c:\projects\> php symfony - -.. _installation-creating-the-app: - -Once the Symfony Installer is installed, create your first Symfony application -with the ``new`` command: +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: .. code-block:: terminal - $ symfony new my_project_name - -This command creates a new directory called ``my_project_name/`` that contains -an empty project based on the most recent stable Symfony version available. In -addition, the installer checks if your system meets the technical requirements -to execute Symfony applications. If not, you'll see the list of changes needed -to meet those requirements. - -.. note:: - - If the installer doesn't work for you or doesn't output anything, make sure - that the PHP `Phar extension`_ is installed and enabled on your computer. - -.. note:: - - If the SSL certificates are not properly installed in your system, you - may get this error: + $ composer create-project symfony/skeleton my-project - cURL error 60: SSL certificate problem: unable to get local issuer certificate. - - You can solve this issue as follows: - - #. Download a file with the updated list of certificates from - https://curl.haxx.se/ca/cacert.pem - #. Move the downloaded ``cacert.pem`` file to some safe location in your system - #. Update your ``php.ini`` file and configure the path to that file: - - .. code-block:: ini - - ; Linux and macOS systems - curl.cainfo = "/path/to/cacert.pem" - - ; Windows systems - curl.cainfo = "C:\path\to\cacert.pem" +.. tip:: -Basing your Project on a Specific Symfony Version -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + 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. -In case your project needs to be based on a specific Symfony version, use the -optional second argument of the ``new`` command: +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 # use the most recent version in any Symfony branch - $ symfony new my_project_name 2.8 - $ symfony new my_project_name 3.1 + $ composer create-project symfony/skeleton my-project "3.3.*" # use a specific Symfony version - $ symfony new my_project_name 2.8.3 - $ symfony new my_project_name 3.1.5 + $ composer create-project symfony/skeleton my-project "3.3.5" # use a beta or RC version (useful for testing new Symfony versions) - $ symfony new my_project 2.7.0-BETA1 - $ symfony new my_project 2.7.0-RC1 - - # use the most recent 'lts' version (Long Term Support version) - $ symfony new my_project_name lts - -Each version has its *own* documentation, which you can select on any documentation -page. + $ composer create-project symfony/skeleton my-project 3.3.0-BETA1 .. note:: @@ -126,61 +53,27 @@ page. to better understand why there are several Symfony versions and which one to use for your projects. -Creating Symfony Applications with Composer -------------------------------------------- - -If you still use PHP 5.3 or can't use the Symfony installer for any reason, you -can create Symfony applications with `Composer`_, the dependency manager used by -modern PHP applications. - -If you don't have Composer installed in your computer, start by -:doc:`installing Composer globally `. Then, execute the -``create-project`` command to create a new Symfony application based on its -latest stable version: - -.. code-block:: terminal - - $ composer create-project symfony/framework-standard-edition my_project_name - -You can also install any other Symfony version by passing a second argument to -the ``create-project`` command: - -.. code-block:: terminal - - $ composer create-project symfony/framework-standard-edition my_project_name "2.8.*" - -.. 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. - Running the Symfony Application ------------------------------- -Symfony leverages the internal PHP web server (available since PHP 5.4) to run -applications while developing them. Therefore, running a Symfony application is -a matter of browsing to the project directory and executing this command: +Symfony provides a utility called ``server`` that leverages the internal PHP web +server to run applications while developing them. First, install that utility +in your application: .. code-block:: terminal - $ cd my_project_name/ - $ php bin/console server:run + $ cd my-project/ + $ composer require server -Then, open your browser and access the ``http://localhost:8000/`` URL to see the -Welcome Page of Symfony: +Then, whenever you want to run the application, execute this command: -.. image:: /_images/quick_tour/welcome.png - :align: center - :alt: Symfony Welcome Page - :class: with-browser +.. code-block:: terminal -If you see a blank page or an error page instead of the Welcome Page, there is -a directory permission misconfiguration. The solution to this problem is -explained in the :doc:`/setup/file_permissions`. + $ php bin/console server:run -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, 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. .. tip:: @@ -188,35 +81,40 @@ pressing ``Ctrl+C`` from the terminal or command console. used on production. Instead, use Apache or Nginx. See :doc:`/setup/web_server_configuration`. -Checking Symfony Application Configuration and Setup ----------------------------------------------------- +Checking Symfony Requirements +----------------------------- -The Symfony Installer checks if your system is ready to run Symfony applications. -However, the PHP configuration for the command console can be different from the -PHP web configuration. For that reason, Symfony provides a visual configuration -checker. Access the following URL to check your configuration and fix any issue -before moving on: +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: -.. code-block:: text +.. code-block:: terminal + + $ cd my-project/ + $ composer require req-checker - http://localhost:8000/config.php +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. -Fixing Permissions Problems ---------------------------- +Once you've fixed all the reported issues, uninstall the requirements checker: -If you have any file permission errors or see a white screen, then read -:doc:`/setup/file_permissions` for more information. +.. code-block:: terminal + + $ 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. +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 prevent bugs and +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): @@ -226,68 +124,64 @@ complexity of your project): $ cd my_project_name/ $ composer update -.. tip:: - - Symfony provides a command to check whether your project's dependencies - contain any known security vulnerability: +.. _install-existing-app: - .. code-block:: terminal +Installing an Existing Symfony Application +------------------------------------------ - $ php bin/console security:check +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. - A good security practice is to execute this command regularly to be able to - update or replace compromised dependencies as soon as possible. +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: -.. _installing-a-symfony2-distribution: +.. code-block:: terminal -Installing the Symfony Demo or Other Distributions --------------------------------------------------- + # clone the project to download its contents + $ cd projects/ + $ git clone ... -You've already downloaded the `Symfony Standard Edition`_: the default starting project -for all Symfony apps. You'll use this project throughout the documentation to build -your app! + # make Composer install the project's dependencies into vendor/ + $ cd my-project/ + $ composer install -Symfony also provides some other projects and starting skeletons that you can use: +Checking for Security Vulnerabilities +------------------------------------- -`The Symfony Demo Application`_ - This is a fully-functional application that shows the recommended way to develop - Symfony applications. The app has been conceived as a learning tool for Symfony - newcomers and its source code contains tons of comments and helpful notes. +Symfony provides a utility called "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: -`The Symfony CMF Standard Edition`_ - The `Symfony CMF`_ is a project that helps make it easier for developers to add - CMS functionality to their Symfony applications. This is a starting project - containing the Symfony CMF. +.. code-block:: terminal -`The Symfony REST Edition`_ - Shows how to build an application that provides a RESTful API using the - `FOSRestBundle`_ and several other related Bundles. + $ cd my-project/ + $ composer require sec-checker -.. _install-existing-app: +From now on, this command will be run automatically whenever you install or +update any dependency in the application. -Installing an Existing Symfony Application -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Installing the Symfony Demo 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. +`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. -It's recommended to not submit some files (:ref:`parameters.yml `) -and directories (``vendor/``, cache, logs) to the repository, so you'll have to do -the following when installing an existing Symfony application: +Run the following command to download and install the Symfony Demo application: .. code-block:: terminal - # clone the project to download its contents - $ cd projects/ - $ git clone ... + $ composer create-project symfony/symfony-demo my-project - # make Composer install the project's dependencies into vendor/ - $ cd my_project_name/ - $ composer install +Now, enter the ``my-project/`` directory, run the internal web server and +browse ``http://127.0.0.1:8000``: + +.. code-block:: terminal - # now Composer will ask you for the values of any undefined parameter - $ ... + $ cd my-project + $ php bin/console server:start Keep Going! ----------- @@ -315,10 +209,5 @@ Go Deeper with Setup .. _`Joyful Development with Symfony`: http://knpuniversity.com/screencast/symfony .. _`Composer`: https://getcomposer.org/ -.. _`Phar extension`: http://php.net/manual/en/intro.phar.php -.. _`Symfony Standard Edition`: https://github.com/symfony/symfony-standard +.. _`technical requirements`: https://symfony.com/doc/current/reference/requirements.html .. _`The Symfony Demo application`: https://github.com/symfony/symfony-demo -.. _`The Symfony CMF Standard Edition`: https://github.com/symfony-cmf/standard-edition -.. _`Symfony CMF`: http://cmf.symfony.com/ -.. _`The Symfony REST Edition`: https://github.com/gimler/symfony-rest-edition -.. _`FOSRestBundle`: https://github.com/FriendsOfSymfony/FOSRestBundle From 0ddc1d6c487ad9ade1c5c0142d515761fcb14eb8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Thu, 20 Jul 2017 09:15:00 +0200 Subject: [PATCH 7/8] Updated the Requirements article for Symfony 4.0 --- reference/requirements.rst | 58 +++++++++++++++----------------------- 1 file changed, 22 insertions(+), 36 deletions(-) diff --git a/reference/requirements.rst b/reference/requirements.rst index 620d02e771b..aee434ed454 100644 --- a/reference/requirements.rst +++ b/reference/requirements.rst @@ -6,50 +6,36 @@ Requirements for Running Symfony ================================ -To run Symfony, your system needs to adhere to a list of requirements. You -can easily see if your system passes all requirements by running the -``web/config.php`` in your Symfony distribution. Since the CLI often uses -a different ``php.ini`` configuration file, it's also a good idea to check -your requirements from the command line via: +Symfony 4.0 requires **PHP 7.1.3** or higher to run, in addition to other minor +requirements. To make things simple, Symfony provides a tool to quickly check if +your system meets all those requirements. Run this command to install the tool: .. code-block:: terminal - $ php bin/symfony_requirements + $ cd your-project/ + $ composer require requirements-checker -Below is the list of required and optional requirements. +Beware that PHP can define a different configuration for the command console and +the web server, so you need to check requirements in both environments. -Required --------- +Checking Requirements for the Web Server +---------------------------------------- -* PHP needs to be a minimum version of PHP 5.5.9 -* `JSON extension`_ needs to be enabled -* `ctype extension`_ needs to be enabled -* Your ``php.ini`` needs to have the ``date.timezone`` setting +The requirements checker tool creates a file called ``check.php`` in the +``public/`` directory of your project. Open that file with your browser to check +the requirements. -Optional --------- +Once you've fixed all the reported issues, uninstall the requirements checker +to avoid leaking internal information about your application to visitors: -* You need to have the PHP-XML module installed -* You need to have at least version 2.6.21 of libxml -* PHP tokenizer needs to be enabled -* mbstring functions need to be enabled -* iconv needs to be enabled -* POSIX needs to be enabled (only on \*nix) -* Intl needs to be installed with ICU 4+ -* APC 3.0.17+ (or another opcode cache needs to be installed) -* ``php.ini`` recommended settings - - * ``short_open_tag = Off`` - * ``magic_quotes_gpc = Off`` - * ``register_globals = Off`` - * ``session.auto_start = Off`` +.. code-block:: terminal -Doctrine --------- + $ cd your-project/ + $ composer remove requirements-checker -If you want to use Doctrine, you will need to have PDO installed. Additionally, -you need to have the PDO driver installed for the database server you want -to use. +Checking Requirements for the Command Console +--------------------------------------------- -.. _`JSON extension`: https://php.net/manual/book.json.php -.. _`ctype extension`: https://php.net/manual/book.ctype.php +The requirements checker tool adds a script to your Composer configuration to +check the requirements automatically. There's no need to execute any command; if +there is any issue, you'll see them in the console output. From 0c4470aa58906af954285d822113025825d3a4c0 Mon Sep 17 00:00:00 2001 From: adouiri Date: Wed, 4 Oct 2017 10:58:52 +0100 Subject: [PATCH 8/8] Update usage.rst --- workflow/usage.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workflow/usage.rst b/workflow/usage.rst index d6f23111884..2744e2bfa91 100644 --- a/workflow/usage.rst +++ b/workflow/usage.rst @@ -125,7 +125,7 @@ like this: 'from' => 'review', 'to' => 'published', ), - 'reject'=> array( + 'reject' => array( 'from' => 'review', 'to' => 'rejected', ),