Skip to content

Commit

Permalink
Merge branch '2.8' into 3.0
Browse files Browse the repository at this point in the history
Conflicts:
	best_practices/creating-the-project.rst
  • Loading branch information
xabbuh committed Dec 17, 2015
2 parents 3ad7f26 + 5275cfb commit 7c60ea1
Show file tree
Hide file tree
Showing 19 changed files with 126 additions and 18 deletions.
10 changes: 7 additions & 3 deletions best_practices/creating-the-project.rst
Expand Up @@ -30,6 +30,10 @@ to create files and execute the following commands:
$ cd projects/
$ symfony new blog
# Windows
c:\> cd projects/
c:\projects\> php symfony new blog
This command creates a new directory called ``blog`` that contains a fresh new
project based on the most recent stable Symfony version available. In addition,
the installer checks if your system meets the technical requirements to execute
Expand Down Expand Up @@ -113,10 +117,10 @@ Symfony documentation uses the AppBundle name.
There is no need to prefix the AppBundle with your own vendor (e.g.
AcmeAppBundle), because this application bundle is never going to be
shared.

.. note::
Another reason to create a new bundle is when you're overriding something

Another reason to create a new bundle is when you're overriding something
in a vendor's bundle (e.g. a controller). See :doc:`/cookbook/bundles/inheritance`.

All in all, this is the typical directory structure of a Symfony application
Expand Down
2 changes: 2 additions & 0 deletions best_practices/web-assets.rst
Expand Up @@ -35,6 +35,8 @@ much more concise:
Using Assetic
-------------

.. include:: /cookbook/assetic/_standard_edition_warning.inc

These days, you probably can't simply create static CSS and JavaScript files
and include them in your template. Instead, you'll probably want to combine
and minify these to improve client-side performance. You may also want to
Expand Down
2 changes: 1 addition & 1 deletion book/controller.rst
Expand Up @@ -655,7 +655,7 @@ and then redirects. The message key (``notice`` in this example) can be anything
you'll use this key to retrieve the message.

In the template of the next page (or even better, in your base layout template),
read any flash messages from the session::
read any flash messages from the session:

.. configuration-block::

Expand Down
4 changes: 2 additions & 2 deletions book/installation.rst
Expand Up @@ -32,7 +32,7 @@ Open your command console and execute the following commands:

.. code-block:: bash
$ sudo curl -LsS http://symfony.com/installer -o /usr/local/bin/symfony
$ sudo curl -LsS https://symfony.com/installer -o /usr/local/bin/symfony
$ sudo chmod a+x /usr/local/bin/symfony
This will create a global ``symfony`` command in your system.
Expand All @@ -44,7 +44,7 @@ Open your command console and execute the following command:

.. code-block:: bash
c:\> php -r "readfile('http://symfony.com/installer');" > symfony
c:\> php -r "readfile('https://symfony.com/installer');" > symfony
Then, move the downloaded ``symfony`` file to your project's directory and
execute it as follows:
Expand Down
4 changes: 3 additions & 1 deletion book/routing.rst
Expand Up @@ -1559,7 +1559,9 @@ By default, the router will generate relative URLs (e.g. ``/blog``). From
a controller, simply pass ``true`` to the third argument of the ``generateUrl()``
method::

$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), true);
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;

$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
// http://www.example.com/blog/my-blog-post

From a template, simply use the ``url()`` function (which generates an absolute
Expand Down
6 changes: 3 additions & 3 deletions book/templating.rst
Expand Up @@ -1130,9 +1130,9 @@ advantage of Symfony's template inheritance.
.. tip::

This section will teach you the philosophy behind including stylesheet
and JavaScript assets in Symfony. Symfony also packages another library,
called Assetic, which follows this philosophy but allows you to do much
more interesting things with those assets. For more information on
and JavaScript assets in Symfony. Symfony is also compatible with another
library, called Assetic, which follows this philosophy but allows you to do
much more interesting things with those assets. For more information on
using Assetic see :doc:`/cookbook/assetic/asset_management`.

Start by adding two blocks to your base template that will hold your assets:
Expand Down
5 changes: 5 additions & 0 deletions cookbook/assetic/_standard_edition_warning.inc
@@ -0,0 +1,5 @@
.. caution::

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
to learn how to install and enable Assetic in your Symfony application.
2 changes: 2 additions & 0 deletions cookbook/assetic/apply_to_option.rst
Expand Up @@ -4,6 +4,8 @@
How to Apply an Assetic Filter to a specific File Extension
===========================================================

.. include:: /cookbook/assetic/_standard_edition_warning.inc

Assetic filters can be applied to individual files, groups of files or even,
as you'll see here, files that have a specific extension. To show you how
to handle each option, suppose that you want to use Assetic's CoffeeScript
Expand Down
83 changes: 83 additions & 0 deletions cookbook/assetic/asset_management.rst
Expand Up @@ -4,6 +4,89 @@
How to Use Assetic for Asset Management
=======================================

Installing and Enabling Assetic
-------------------------------

Starting from Symfony 2.8, Assetic is no longer included by default in the
Symfony Standard Edition. Before using any of its features, install the
AsseticBundle executing this console command in your project:

.. code-block:: bash
$ composer require symfony/assetic-bundle
Then, enable the bundle in the ``AppKernel.php`` file of your Symfony application::

// app/AppKernel.php

// ...
class AppKernel extends Kernel
{
// ...

public function registerBundles()
{
$bundles = array(
// ...
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
);

// ...
}
}

Finally, add the following minimal configuration to enable Assetic support in
your application:

.. configuration-block::

.. code-block:: yaml
# app/config/config.yml
assetic:
debug: '%kernel.debug%'
use_controller: '%kernel.debug%'
filters:
cssrewrite: ~
# ...
.. code-block:: xml
<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:assetic="http://symfony.com/schema/dic/assetic"
xsi:schemaLocation="http://symfony.com/schema/dic/services
http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/assetic
http://symfony.com/schema/dic/assetic/assetic-1.0.xsd">
<assetic:config debug="%kernel.debug%" use-controller="%kernel.debug%">
<assetic:filters cssrewrite="null" />
</assetic:config>
<!-- ... -->
</container>
.. code-block:: php
// app/config/config.php
$container->loadFromExtension('assetic', array(
'debug' => '%kernel.debug%',
'use_controller' => '%kernel.debug%',
'filters' => array(
'cssrewrite' => null,
),
// ...
));
// ...
Introducing Assetic
-------------------

Assetic combines two major ideas: :ref:`assets <cookbook-assetic-assets>` and
:ref:`filters <cookbook-assetic-filters>`. The assets are files such as CSS,
JavaScript and image files. The filters are things that can be applied to
Expand Down
2 changes: 2 additions & 0 deletions cookbook/assetic/index.rst
@@ -1,6 +1,8 @@
Assetic
=======

.. include:: /cookbook/assetic/_standard_edition_warning.inc

.. toctree::
:maxdepth: 2

Expand Down
2 changes: 2 additions & 0 deletions cookbook/assetic/jpeg_optimize.rst
Expand Up @@ -4,6 +4,8 @@
How to Use Assetic for Image Optimization with Twig Functions
=============================================================

.. include:: /cookbook/assetic/_standard_edition_warning.inc

Among its many filters, Assetic has four filters which can be used for on-the-fly
image optimization. This allows you to get the benefits of smaller file sizes
without having to use an image editor to process each image. The results
Expand Down
2 changes: 2 additions & 0 deletions cookbook/assetic/php.rst
Expand Up @@ -4,6 +4,8 @@
Combining, Compiling and Minimizing Web Assets with PHP Libraries
=================================================================

.. include:: /cookbook/assetic/_standard_edition_warning.inc

The official Symfony Best Practices recommend to use Assetic to
:doc:`manage web assets </best_practices/web-assets>`, unless you are
comfortable with JavaScript-based front-end tools.
Expand Down
2 changes: 2 additions & 0 deletions cookbook/assetic/uglifyjs.rst
Expand Up @@ -4,6 +4,8 @@
How to Minify CSS/JS Files (Using UglifyJS and UglifyCSS)
=========================================================

.. include:: /cookbook/assetic/_standard_edition_warning.inc

`UglifyJS`_ is a JavaScript parser/compressor/beautifier toolkit. It can be used
to combine and minify JavaScript assets so that they require less HTTP requests
and make your site load faster. `UglifyCSS`_ is a CSS compressor/beautifier
Expand Down
2 changes: 2 additions & 0 deletions cookbook/assetic/yuicompressor.rst
Expand Up @@ -10,6 +10,8 @@ How to Minify JavaScripts and Stylesheets with YUI Compressor
**strongly advised to avoid using YUI utilities** unless strictly necessary.
Read :doc:`/cookbook/assetic/uglifyjs` for a modern and up-to-date alternative.

.. include:: /cookbook/assetic/_standard_edition_warning.inc

Yahoo! provides an excellent utility for minifying JavaScripts and stylesheets
so they travel over the wire faster, the `YUI Compressor`_. Thanks to Assetic,
you can take advantage of this tool very easily.
Expand Down
3 changes: 1 addition & 2 deletions cookbook/controller/service.rst
Expand Up @@ -285,8 +285,7 @@ controller:
in the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface`.

:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getDoctrine` (service: ``doctrine``)

*Simply inject doctrine instead of fetching it from the container*
*Simply inject doctrine instead of fetching it from the container.*

:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getUser` (service: ``security.token_storage``)
.. code-block:: php
Expand Down
4 changes: 2 additions & 2 deletions cookbook/security/custom_provider.rst
Expand Up @@ -324,9 +324,9 @@ options, the password may be encoded multiple times and encoded to base64.
before comparing it to your encoded password. If ``getSalt()`` returns
nothing, then the submitted password is simply encoded using the algorithm
you specify in ``security.yml``. If a salt *is* specified, then the following
value is created and *then* hashed via the algorithm:
value is created and *then* hashed via the algorithm::

``$password.'{'.$salt.'}';``
$password.'{'.$salt.'}'

If your external users have their passwords salted via a different method,
then you'll need to do a bit more work so that Symfony properly encodes
Expand Down
2 changes: 2 additions & 0 deletions cookbook/upgrade/_update_dep_errors.rst.inc
Expand Up @@ -4,6 +4,8 @@ Dependency Errors
If you get a dependency error, it may simply mean that you need to upgrade
other Symfony dependencies too. In that case, try the following command:

.. code-block:: bash

$ composer update symfony/symfony --with-dependencies

This updates ``symfony/symfony`` and *all* packages that it depends on, which will
Expand Down
2 changes: 2 additions & 0 deletions reference/configuration/assetic.rst
Expand Up @@ -4,6 +4,8 @@
AsseticBundle Configuration ("assetic")
=======================================

.. include:: /cookbook/assetic/_standard_edition_warning.inc

Full Default Configuration
--------------------------

Expand Down
5 changes: 1 addition & 4 deletions reference/twig_reference.rst
Expand Up @@ -739,10 +739,7 @@ Those bundles can have other Twig extensions:

* **Twig Extensions** includes some interesting extensions that do not belong
to the Twig core. You can read more in `the official Twig Extensions
documentation`_;
* **Assetic** adds the ``{% stylesheets %}``, ``{% javascripts %}`` and
``{% image %}`` tags. You can read more about them in
:doc:`the Assetic Documentation </cookbook/assetic/asset_management>`.
documentation`_.

.. _`Twig Reference`: http://twig.sensiolabs.org/documentation#reference
.. _`the official Twig Extensions documentation`: http://twig.sensiolabs.org/doc/extensions/index.html

0 comments on commit 7c60ea1

Please sign in to comment.