Skip to content

Commit 7c60ea1

Browse files
committed
Merge branch '2.8' into 3.0
Conflicts: best_practices/creating-the-project.rst
2 parents 3ad7f26 + 5275cfb commit 7c60ea1

19 files changed

+126
-18
lines changed

best_practices/creating-the-project.rst

+7-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ to create files and execute the following commands:
3030
$ cd projects/
3131
$ symfony new blog
3232
33+
# Windows
34+
c:\> cd projects/
35+
c:\projects\> php symfony new blog
36+
3337
This command creates a new directory called ``blog`` that contains a fresh new
3438
project based on the most recent stable Symfony version available. In addition,
3539
the installer checks if your system meets the technical requirements to execute
@@ -113,10 +117,10 @@ Symfony documentation uses the AppBundle name.
113117
There is no need to prefix the AppBundle with your own vendor (e.g.
114118
AcmeAppBundle), because this application bundle is never going to be
115119
shared.
116-
120+
117121
.. note::
118-
119-
Another reason to create a new bundle is when you're overriding something
122+
123+
Another reason to create a new bundle is when you're overriding something
120124
in a vendor's bundle (e.g. a controller). See :doc:`/cookbook/bundles/inheritance`.
121125

122126
All in all, this is the typical directory structure of a Symfony application

best_practices/web-assets.rst

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,8 @@ much more concise:
3535
Using Assetic
3636
-------------
3737

38+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
39+
3840
These days, you probably can't simply create static CSS and JavaScript files
3941
and include them in your template. Instead, you'll probably want to combine
4042
and minify these to improve client-side performance. You may also want to

book/controller.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ and then redirects. The message key (``notice`` in this example) can be anything
655655
you'll use this key to retrieve the message.
656656

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

660660
.. configuration-block::
661661

book/installation.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Open your command console and execute the following commands:
3232

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

4545
.. code-block:: bash
4646
47-
c:\> php -r "readfile('http://symfony.com/installer');" > symfony
47+
c:\> php -r "readfile('https://symfony.com/installer');" > symfony
4848
4949
Then, move the downloaded ``symfony`` file to your project's directory and
5050
execute it as follows:

book/routing.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -1559,7 +1559,9 @@ By default, the router will generate relative URLs (e.g. ``/blog``). From
15591559
a controller, simply pass ``true`` to the third argument of the ``generateUrl()``
15601560
method::
15611561

1562-
$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), true);
1562+
use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
1563+
1564+
$this->generateUrl('blog_show', array('slug' => 'my-blog-post'), UrlGeneratorInterface::ABSOLUTE_URL);
15631565
// http://www.example.com/blog/my-blog-post
15641566

15651567
From a template, simply use the ``url()`` function (which generates an absolute

book/templating.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -1130,9 +1130,9 @@ advantage of Symfony's template inheritance.
11301130
.. tip::
11311131

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

11381138
Start by adding two blocks to your base template that will hold your assets:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.. caution::
2+
3+
Starting from Symfony 2.8, Assetic is no longer included by default in the
4+
Symfony Standard Edition. Refer to :doc:`this article </cookbook/assetic/asset_management>`
5+
to learn how to install and enable Assetic in your Symfony application.

cookbook/assetic/apply_to_option.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
How to Apply an Assetic Filter to a specific File Extension
55
===========================================================
66

7+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
8+
79
Assetic filters can be applied to individual files, groups of files or even,
810
as you'll see here, files that have a specific extension. To show you how
911
to handle each option, suppose that you want to use Assetic's CoffeeScript

cookbook/assetic/asset_management.rst

+83
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,89 @@
44
How to Use Assetic for Asset Management
55
=======================================
66

7+
Installing and Enabling Assetic
8+
-------------------------------
9+
10+
Starting from Symfony 2.8, Assetic is no longer included by default in the
11+
Symfony Standard Edition. Before using any of its features, install the
12+
AsseticBundle executing this console command in your project:
13+
14+
.. code-block:: bash
15+
16+
$ composer require symfony/assetic-bundle
17+
18+
Then, enable the bundle in the ``AppKernel.php`` file of your Symfony application::
19+
20+
// app/AppKernel.php
21+
22+
// ...
23+
class AppKernel extends Kernel
24+
{
25+
// ...
26+
27+
public function registerBundles()
28+
{
29+
$bundles = array(
30+
// ...
31+
new Symfony\Bundle\AsseticBundle\AsseticBundle(),
32+
);
33+
34+
// ...
35+
}
36+
}
37+
38+
Finally, add the following minimal configuration to enable Assetic support in
39+
your application:
40+
41+
.. configuration-block::
42+
43+
.. code-block:: yaml
44+
45+
# app/config/config.yml
46+
assetic:
47+
debug: '%kernel.debug%'
48+
use_controller: '%kernel.debug%'
49+
filters:
50+
cssrewrite: ~
51+
52+
# ...
53+
54+
.. code-block:: xml
55+
56+
<!-- app/config/config.xml -->
57+
<?xml version="1.0" encoding="UTF-8" ?>
58+
<container xmlns="http://symfony.com/schema/dic/services"
59+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
60+
xmlns:assetic="http://symfony.com/schema/dic/assetic"
61+
xsi:schemaLocation="http://symfony.com/schema/dic/services
62+
http://symfony.com/schema/dic/services/services-1.0.xsd
63+
http://symfony.com/schema/dic/assetic
64+
http://symfony.com/schema/dic/assetic/assetic-1.0.xsd">
65+
66+
<assetic:config debug="%kernel.debug%" use-controller="%kernel.debug%">
67+
<assetic:filters cssrewrite="null" />
68+
</assetic:config>
69+
70+
<!-- ... -->
71+
</container>
72+
73+
.. code-block:: php
74+
75+
// app/config/config.php
76+
$container->loadFromExtension('assetic', array(
77+
'debug' => '%kernel.debug%',
78+
'use_controller' => '%kernel.debug%',
79+
'filters' => array(
80+
'cssrewrite' => null,
81+
),
82+
// ...
83+
));
84+
85+
// ...
86+
87+
Introducing Assetic
88+
-------------------
89+
790
Assetic combines two major ideas: :ref:`assets <cookbook-assetic-assets>` and
891
:ref:`filters <cookbook-assetic-filters>`. The assets are files such as CSS,
992
JavaScript and image files. The filters are things that can be applied to

cookbook/assetic/index.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
Assetic
22
=======
33

4+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
5+
46
.. toctree::
57
:maxdepth: 2
68

cookbook/assetic/jpeg_optimize.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
How to Use Assetic for Image Optimization with Twig Functions
55
=============================================================
66

7+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
8+
79
Among its many filters, Assetic has four filters which can be used for on-the-fly
810
image optimization. This allows you to get the benefits of smaller file sizes
911
without having to use an image editor to process each image. The results

cookbook/assetic/php.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
Combining, Compiling and Minimizing Web Assets with PHP Libraries
55
=================================================================
66

7+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
8+
79
The official Symfony Best Practices recommend to use Assetic to
810
:doc:`manage web assets </best_practices/web-assets>`, unless you are
911
comfortable with JavaScript-based front-end tools.

cookbook/assetic/uglifyjs.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
How to Minify CSS/JS Files (Using UglifyJS and UglifyCSS)
55
=========================================================
66

7+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
8+
79
`UglifyJS`_ is a JavaScript parser/compressor/beautifier toolkit. It can be used
810
to combine and minify JavaScript assets so that they require less HTTP requests
911
and make your site load faster. `UglifyCSS`_ is a CSS compressor/beautifier

cookbook/assetic/yuicompressor.rst

+2
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ How to Minify JavaScripts and Stylesheets with YUI Compressor
1010
**strongly advised to avoid using YUI utilities** unless strictly necessary.
1111
Read :doc:`/cookbook/assetic/uglifyjs` for a modern and up-to-date alternative.
1212

13+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
14+
1315
Yahoo! provides an excellent utility for minifying JavaScripts and stylesheets
1416
so they travel over the wire faster, the `YUI Compressor`_. Thanks to Assetic,
1517
you can take advantage of this tool very easily.

cookbook/controller/service.rst

+1-2
Original file line numberDiff line numberDiff line change
@@ -285,8 +285,7 @@ controller:
285285
in the :class:`Symfony\\Component\\Routing\\Generator\\UrlGeneratorInterface`.
286286

287287
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getDoctrine` (service: ``doctrine``)
288-
289-
*Simply inject doctrine instead of fetching it from the container*
288+
*Simply inject doctrine instead of fetching it from the container.*
290289

291290
:method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::getUser` (service: ``security.token_storage``)
292291
.. code-block:: php

cookbook/security/custom_provider.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -324,9 +324,9 @@ options, the password may be encoded multiple times and encoded to base64.
324324
before comparing it to your encoded password. If ``getSalt()`` returns
325325
nothing, then the submitted password is simply encoded using the algorithm
326326
you specify in ``security.yml``. If a salt *is* specified, then the following
327-
value is created and *then* hashed via the algorithm:
327+
value is created and *then* hashed via the algorithm::
328328

329-
``$password.'{'.$salt.'}';``
329+
$password.'{'.$salt.'}'
330330

331331
If your external users have their passwords salted via a different method,
332332
then you'll need to do a bit more work so that Symfony properly encodes

cookbook/upgrade/_update_dep_errors.rst.inc

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Dependency Errors
44
If you get a dependency error, it may simply mean that you need to upgrade
55
other Symfony dependencies too. In that case, try the following command:
66

7+
.. code-block:: bash
8+
79
$ composer update symfony/symfony --with-dependencies
810

911
This updates ``symfony/symfony`` and *all* packages that it depends on, which will

reference/configuration/assetic.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
AsseticBundle Configuration ("assetic")
55
=======================================
66

7+
.. include:: /cookbook/assetic/_standard_edition_warning.inc
8+
79
Full Default Configuration
810
--------------------------
911

reference/twig_reference.rst

+1-4
Original file line numberDiff line numberDiff line change
@@ -739,10 +739,7 @@ Those bundles can have other Twig extensions:
739739

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

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

0 commit comments

Comments
 (0)