Skip to content

Commit baa7579

Browse files
committed
Documented some more options
1 parent b5415d9 commit baa7579

File tree

2 files changed

+225
-48
lines changed

2 files changed

+225
-48
lines changed

book/templating.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,8 @@ Controllers are fast to execute and promote good code organization and reuse.
671671
Of course, like all controllers, they should ideally be "skinny", meaning
672672
that as much code as possible lives in reusable :doc:`services </book/service_container>`.
673673

674+
.. _book-templating-hinclude:
675+
674676
Asynchronous Content with hinclude.js
675677
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
676678

reference/configuration/framework.rst

Lines changed: 223 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Configuration
2727
* `test`_
2828
* `default_locale`_
2929
* `trusted_hosts`_
30-
* `form`_
30+
* :ref:`form <reference-framework-form>`_
3131
* :ref:`enabled <form.enabled>`
3232
* `csrf_protection`_
3333
* :ref:`enabled <form.csrf_protection.enabled>`
@@ -50,15 +50,15 @@ Configuration
5050
* `ip`_
5151
* :ref:`path <profiler.matcher.path>`
5252
* `service`_
53-
* router
54-
* resource
55-
* type
56-
* http_port
57-
* https_port
58-
* strict_requirements
53+
* `router`_
54+
* `resource`_
55+
* `type`_
56+
* `http_port`_
57+
* `https_port`_
58+
* `strict_requirements`_
5959
* `session`_
60-
* storage_id
61-
* handler_id
60+
* `storage_id`_
61+
* `handler_id`_
6262
* `name`_
6363
* `cookie_lifetime`_
6464
* `cookie_path`_
@@ -72,15 +72,15 @@ Configuration
7272
* `templating`_
7373
* `assets_version`_
7474
* `assets_version_format`_
75-
* hinclude_default_template
76-
* form
77-
* resources
75+
* `hinclude_default_template`_
76+
* :ref:`form <templating.form>`_
77+
* `resources`_
7878
* `assets_base_urls`_
7979
* http
8080
* ssl
81-
* cache
82-
* engines
83-
* loaders
81+
* `cache`_
82+
* `engines`_
83+
* `loaders`_
8484
* packages
8585
* translator
8686
* enabled
@@ -585,9 +585,85 @@ service
585585

586586
This setting contains the service id of a custom matcher.
587587

588+
router
589+
~~~~~~
590+
591+
resource
592+
........
593+
594+
**type**: ``string`` **required**
595+
596+
Specifies the path to the routes used by the default router.
597+
598+
It becomes the service container parameter called ``router.resource``.
599+
600+
type
601+
....
602+
603+
**type**: ``string``
604+
605+
The type of the resource to hint the loaders about the format. This isn't
606+
needed when you use the default routers with the expected file extensions
607+
(``.xml``, ``.yml`` / ``.yaml``, ``.php``).
608+
609+
http_port
610+
.........
611+
612+
**type**: ``integer`` **default**: ``80``
613+
614+
The port for normal http requests (this is used when matching the scheme).
615+
616+
It becomes the service container parameter called ``router.resource``.
617+
618+
https_port
619+
..........
620+
621+
**type**: ``integer`` **default**: ``443``
622+
623+
The port for https requests (this is used when matching the scheme).
624+
625+
strict_requirements
626+
...................
627+
628+
**type**: ``mixed`` **default**: ``true``
629+
630+
Determines the behaviour when a route matches, but the parameters do not match
631+
the specified requirements for that route. Can be one of:
632+
633+
``true``
634+
Throw an exception when the requirements are not met;
635+
``false``
636+
Disable exceptions when the requirements are not met and return ``null``
637+
instead;
638+
``null``
639+
Disable checking the requirements (thus, match the route even when the
640+
requirements don't match).
641+
642+
``false`` is recommended in the development environment, while ``false`` or
643+
``null`` might be preferred in production.
644+
588645
session
589646
~~~~~~~
590647

648+
storage_id
649+
..........
650+
651+
**type**: ``string`` **default**: ``'session.storage.native'``
652+
653+
The service id used for session storage. The ``session.storage`` service alias
654+
will be set to this service id.
655+
656+
handler_id
657+
..........
658+
659+
**type**: ``string`` **default**: ``'session.handler.native_file'``
660+
661+
The service id used for session storage. The ``session.handler`` service alias
662+
will be set to this service id.
663+
664+
You can also set it to ``null``, to default to the handler of your PHP
665+
installation.
666+
591667
name
592668
....
593669

@@ -639,6 +715,13 @@ This means that the cookie won't be accessible by scripting languages, such
639715
as JavaScript. This setting can effectively help to reduce identity theft
640716
through XSS attacks.
641717

718+
gc_divisor
719+
..........
720+
721+
**type**: ``integer`` **default**: ``100``
722+
723+
See `gc_probability`_.
724+
642725
gc_probability
643726
..............
644727

@@ -649,13 +732,6 @@ on every session initialization. The probability is calculated by using
649732
``gc_probability`` / ``gc_divisor``, e.g. 1/100 means there is a 1% chance
650733
that the GC process will start on each request.
651734

652-
gc_divisor
653-
..........
654-
655-
**type**: ``integer`` **default**: ``100``
656-
657-
See `gc_probability`_.
658-
659735
gc_maxlifetime
660736
..............
661737

@@ -684,7 +760,7 @@ the value to ``null``:
684760
# app/config/config.yml
685761
framework:
686762
session:
687-
save_path: null
763+
save_path: ~
688764
689765
.. code-block:: xml
690766
@@ -721,31 +797,14 @@ For more details, see :doc:`/cookbook/serializer`.
721797
templating
722798
~~~~~~~~~~
723799

724-
assets_base_urls
725-
................
726-
727-
**default**: ``{ http: [], ssl: [] }``
728-
729-
This option allows you to define base URLs to be used for assets referenced
730-
from ``http`` and ``ssl`` (``https``) pages. A string value may be provided in
731-
lieu of a single-element array. If multiple base URLs are provided, Symfony2
732-
will select one from the collection each time it generates an asset's path.
733-
734-
For your convenience, ``assets_base_urls`` can be set directly with a string or
735-
array of strings, which will be automatically organized into collections of base
736-
URLs for ``http`` and ``https`` requests. If a URL starts with ``https://`` or
737-
is `protocol-relative`_ (i.e. starts with `//`) it will be added to both
738-
collections. URLs starting with ``http://`` will only be added to the
739-
``http`` collection.
740-
741800
.. _ref-framework-assets-version:
742801

743802
assets_version
744803
..............
745804

746805
**type**: ``string``
747806

748-
This option is used to *bust* the cache on assets by globally adding a query
807+
This option is used to bust the cache on assets by globally adding a query
749808
parameter to all rendered asset paths (e.g. ``/images/logo.png?v2``). This
750809
applies only to assets rendered via the Twig ``asset`` function (or PHP equivalent)
751810
as well as assets rendered with Assetic.
@@ -796,19 +855,22 @@ Now, the same asset will be rendered as ``/images/logo.png?v2`` If you use
796855
this feature, you **must** manually increment the ``assets_version`` value
797856
before each deployment so that the query parameters change.
798857

799-
You can also control how the query string works via the `assets_version_format`_
800-
option.
858+
.. tip::
859+
860+
As with all settings, you can use a parameter as value for the
861+
``assets_version``. This makes it easier to increment the cache on each
862+
deployment.
801863

802864
assets_version_format
803865
.....................
804866

805867
**type**: ``string`` **default**: ``%%s?%%s``
806868

807-
This specifies a :phpfunction:`sprintf` pattern that will be used with the `assets_version`_
808-
option to construct an asset's path. By default, the pattern adds the asset's
809-
version as a query string. For example, if ``assets_version_format`` is set to
810-
``%%s?version=%%s`` and ``assets_version`` is set to ``5``, the asset's path
811-
would be ``/images/logo.png?version=5``.
869+
This specifies a :phpfunction:`sprintf` pattern that will be used with the
870+
`assets_version`_ option to construct an asset's path. By default, the pattern
871+
adds the asset's version as a query string. For example, if
872+
``assets_version_format`` is set to ``%%s?version=%%s`` and ``assets_version``
873+
is set to ``5``, the asset's path would be ``/images/logo.png?version=5``.
812874

813875
.. note::
814876

@@ -834,6 +896,119 @@ would be ``/images/logo.png?version=5``.
834896
The latter option is useful if you would like older asset versions to remain
835897
accessible at their original URL.
836898

899+
hinclude_default_template
900+
.........................
901+
902+
**type**: ``string`` **default**: ``null``
903+
904+
Sets the content shown during the loading of the fragment or when JavaScript is
905+
disabled. This can be either a template name or the content itself. It becomes
906+
the service container parameter named ``fragment.renderer.hinclude.global_template``.
907+
908+
.. seealso::
909+
910+
See :ref:`book-templating-hinclude` for more information about hinclude.
911+
912+
.. _templating.form:
913+
914+
form
915+
....
916+
917+
918+
resources
919+
"""""""""
920+
921+
**type**: ``string[]`` **default**: ``[FrameworkBundle:Form]``
922+
923+
A list of all resources for form theming in PHP. If you have custom global form
924+
themes in ``src/WebsiteBundle/Resources/views/Form``, you can configure this like:
925+
926+
.. configuration-block::
927+
928+
.. code-block:: yaml
929+
930+
framework:
931+
templating:
932+
form:
933+
resources:
934+
- 'WebsiteBundle:Form'
935+
936+
.. code-block:: xml
937+
938+
<framework:config>
939+
<framework:templating>
940+
<framework:form>
941+
<framework:resource>WebsiteBundle:Form</framework:resource>
942+
</framework:form>
943+
</framework:templating>
944+
</framework:config>
945+
946+
.. code-block:: php
947+
948+
$container->loadFromExtension('framework', array(
949+
'templating' => array(
950+
'form' => array(
951+
'resources' => array(
952+
'WebsiteBundle:Form'
953+
),
954+
),
955+
),
956+
));
957+
958+
.. note::
959+
960+
The default form templates from ``FrameworkBundle:Form`` will always be
961+
included in the form resources.
962+
963+
assets_base_urls
964+
................
965+
966+
**type**: ``{ http: [], ssl: [] }``
967+
968+
This option allows you to define base URLs to be used for assets referenced
969+
from ``http`` and ``ssl`` (``https``) pages. A string value may be provided in
970+
lieu of a single-element array. If multiple base URLs are provided, Symfony2
971+
will select one from the collection each time it generates an asset's path.
972+
973+
For your convenience, ``assets_base_urls`` can be set directly with a string or
974+
array of strings, which will be automatically organized into collections of base
975+
URLs for ``http`` and ``https`` requests. If a URL starts with ``https://`` or
976+
is `protocol-relative`_ (i.e. starts with ``//``), it will be added to both
977+
collections. URLs starting with ``http://`` will only be added to the
978+
``http`` collection.
979+
980+
cache
981+
.....
982+
983+
**type**: ``string``
984+
985+
The path to the cache directory for templates. When this is not set, caching is
986+
disabled. It becomes the service container parameter named
987+
``templating.loader.cache.path``.
988+
989+
engines
990+
.......
991+
992+
**type**: ``string[]`` / ``string`` **required**
993+
994+
The Templating Engine to use. This can either be a string (when only one engine
995+
is configured) or an array of engines. It becomes the service container
996+
parameter named ``templating.engines``.
997+
998+
At least one engine is required.
999+
1000+
loaders
1001+
.......
1002+
1003+
**type**: ``string[]``
1004+
1005+
An array (or a string when configuring just one loader) of service ids for
1006+
templating loaders.
1007+
1008+
packages
1009+
........
1010+
1011+
8371012
.. _`protocol-relative`: http://tools.ietf.org/html/rfc3986#section-4.2
8381013
.. _`PhpStormOpener`: https://github.com/pinepain/PhpStormOpener
8391014
.. _`HTTP Host header attacks`: http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html

0 commit comments

Comments
 (0)