Skip to content

Commit d440eb2

Browse files
committed
Documented some more options
1 parent 8a29ad9 commit d440eb2

File tree

2 files changed

+229
-49
lines changed

2 files changed

+229
-49
lines changed

book/templating.rst

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

691+
.. _book-templating-hinclude:
692+
691693
Asynchronous Content with hinclude.js
692694
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
693695

reference/configuration/framework.rst

Lines changed: 227 additions & 49 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,22 +72,22 @@ 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+
* :ref:`cache <templating.cache>`
82+
* `engines`_
83+
* `loaders`_
8484
* packages
8585
* `translator`_
8686
* :ref:`enabled <translator.enabled>`
8787
* `fallback`_
8888
* `validation`_
8989
* enabled
90-
* `cache`_
90+
* :ref:`cache <validation.cache>`
9191
* `enable_annotations`_
9292
* `translation_domain`_
9393
* annotations
@@ -601,9 +601,85 @@ service
601601

602602
This setting contains the service id of a custom matcher.
603603

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

664+
storage_id
665+
..........
666+
667+
**type**: ``string`` **default**: ``'session.storage.native'``
668+
669+
The service id used for session storage. The ``session.storage`` service alias
670+
will be set to this service id.
671+
672+
handler_id
673+
..........
674+
675+
**type**: ``string`` **default**: ``'session.handler.native_file'``
676+
677+
The service id used for session storage. The ``session.handler`` service alias
678+
will be set to this service id.
679+
680+
You can also set it to ``null``, to default to the handler of your PHP
681+
installation.
682+
607683
name
608684
....
609685

@@ -655,6 +731,13 @@ This means that the cookie won't be accessible by scripting languages, such
655731
as JavaScript. This setting can effectively help to reduce identity theft
656732
through XSS attacks.
657733

734+
gc_divisor
735+
..........
736+
737+
**type**: ``integer`` **default**: ``100``
738+
739+
See `gc_probability`_.
740+
658741
gc_probability
659742
..............
660743

@@ -665,13 +748,6 @@ on every session initialization. The probability is calculated by using
665748
``gc_probability`` / ``gc_divisor``, e.g. 1/100 means there is a 1% chance
666749
that the GC process will start on each request.
667750

668-
gc_divisor
669-
..........
670-
671-
**type**: ``integer`` **default**: ``100``
672-
673-
See `gc_probability`_.
674-
675751
gc_maxlifetime
676752
..............
677753

@@ -700,7 +776,7 @@ the value to ``null``:
700776
# app/config/config.yml
701777
framework:
702778
session:
703-
save_path: null
779+
save_path: ~
704780
705781
.. code-block:: xml
706782
@@ -745,31 +821,14 @@ For more details, see :doc:`/cookbook/serializer`.
745821
templating
746822
~~~~~~~~~~
747823

748-
assets_base_urls
749-
................
750-
751-
**default**: ``{ http: [], ssl: [] }``
752-
753-
This option allows you to define base URLs to be used for assets referenced
754-
from ``http`` and ``ssl`` (``https``) pages. A string value may be provided in
755-
lieu of a single-element array. If multiple base URLs are provided, Symfony
756-
will select one from the collection each time it generates an asset's path.
757-
758-
For your convenience, ``assets_base_urls`` can be set directly with a string or
759-
array of strings, which will be automatically organized into collections of base
760-
URLs for ``http`` and ``https`` requests. If a URL starts with ``https://`` or
761-
is `protocol-relative`_ (i.e. starts with `//`) it will be added to both
762-
collections. URLs starting with ``http://`` will only be added to the
763-
``http`` collection.
764-
765824
.. _ref-framework-assets-version:
766825

767826
assets_version
768827
..............
769828

770829
**type**: ``string``
771830

772-
This option is used to *bust* the cache on assets by globally adding a query
831+
This option is used to bust the cache on assets by globally adding a query
773832
parameter to all rendered asset paths (e.g. ``/images/logo.png?v2``). This
774833
applies only to assets rendered via the Twig ``asset`` function (or PHP equivalent)
775834
as well as assets rendered with Assetic.
@@ -829,19 +888,22 @@ Now, the same asset will be rendered as ``/images/logo.png?v2`` If you use
829888
this feature, you **must** manually increment the ``assets_version`` value
830889
before each deployment so that the query parameters change.
831890

832-
You can also control how the query string works via the `assets_version_format`_
833-
option.
891+
.. tip::
892+
893+
As with all settings, you can use a parameter as value for the
894+
``assets_version``. This makes it easier to increment the cache on each
895+
deployment.
834896

835897
assets_version_format
836898
.....................
837899

838900
**type**: ``string`` **default**: ``%%s?%%s``
839901

840-
This specifies a :phpfunction:`sprintf` pattern that will be used with the `assets_version`_
841-
option to construct an asset's path. By default, the pattern adds the asset's
842-
version as a query string. For example, if ``assets_version_format`` is set to
843-
``%%s?version=%%s`` and ``assets_version`` is set to ``5``, the asset's path
844-
would be ``/images/logo.png?version=5``.
902+
This specifies a :phpfunction:`sprintf` pattern that will be used with the
903+
`assets_version`_ option to construct an asset's path. By default, the pattern
904+
adds the asset's version as a query string. For example, if
905+
``assets_version_format`` is set to ``%%s?version=%%s`` and ``assets_version``
906+
is set to ``5``, the asset's path would be ``/images/logo.png?version=5``.
845907

846908
.. note::
847909

@@ -867,6 +929,119 @@ would be ``/images/logo.png?version=5``.
867929
The latter option is useful if you would like older asset versions to remain
868930
accessible at their original URL.
869931

932+
hinclude_default_template
933+
.........................
934+
935+
**type**: ``string`` **default**: ``null``
936+
937+
Sets the content shown during the loading of the fragment or when JavaScript is
938+
disabled. This can be either a template name or the content itself. It becomes
939+
the service container parameter named ``fragment.renderer.hinclude.global_template``.
940+
941+
.. seealso::
942+
943+
See :ref:`book-templating-hinclude` for more information about hinclude.
944+
945+
.. _templating.form:
946+
947+
form
948+
....
949+
950+
resources
951+
"""""""""
952+
953+
**type**: ``string[]`` **default**: ``[FrameworkBundle:Form]``
954+
955+
A list of all resources for form theming in PHP. If you have custom global form
956+
themes in ``src/WebsiteBundle/Resources/views/Form``, you can configure this like:
957+
958+
.. configuration-block::
959+
960+
.. code-block:: yaml
961+
962+
framework:
963+
templating:
964+
form:
965+
resources:
966+
- 'WebsiteBundle:Form'
967+
968+
.. code-block:: xml
969+
970+
<framework:config>
971+
<framework:templating>
972+
<framework:form>
973+
<framework:resource>WebsiteBundle:Form</framework:resource>
974+
</framework:form>
975+
</framework:templating>
976+
</framework:config>
977+
978+
.. code-block:: php
979+
980+
$container->loadFromExtension('framework', array(
981+
'templating' => array(
982+
'form' => array(
983+
'resources' => array(
984+
'WebsiteBundle:Form'
985+
),
986+
),
987+
),
988+
));
989+
990+
.. note::
991+
992+
The default form templates from ``FrameworkBundle:Form`` will always be
993+
included in the form resources.
994+
995+
assets_base_urls
996+
................
997+
998+
**type**: ``{ http: [], ssl: [] }``
999+
1000+
This option allows you to define base URLs to be used for assets referenced
1001+
from ``http`` and ``ssl`` (``https``) pages. A string value may be provided in
1002+
lieu of a single-element array. If multiple base URLs are provided, Symfony2
1003+
will select one from the collection each time it generates an asset's path.
1004+
1005+
For your convenience, ``assets_base_urls`` can be set directly with a string or
1006+
array of strings, which will be automatically organized into collections of base
1007+
URLs for ``http`` and ``https`` requests. If a URL starts with ``https://`` or
1008+
is `protocol-relative`_ (i.e. starts with ``//``), it will be added to both
1009+
collections. URLs starting with ``http://`` will only be added to the
1010+
``http`` collection.
1011+
1012+
.. _templating.cache:
1013+
1014+
cache
1015+
.....
1016+
1017+
**type**: ``string``
1018+
1019+
The path to the cache directory for templates. When this is not set, caching is
1020+
disabled. It becomes the service container parameter named
1021+
``templating.loader.cache.path``.
1022+
1023+
engines
1024+
.......
1025+
1026+
**type**: ``string[]`` / ``string`` **required**
1027+
1028+
The Templating Engine to use. This can either be a string (when only one engine
1029+
is configured) or an array of engines. It becomes the service container
1030+
parameter named ``templating.engines``.
1031+
1032+
At least one engine is required.
1033+
1034+
loaders
1035+
.......
1036+
1037+
**type**: ``string[]``
1038+
1039+
An array (or a string when configuring just one loader) of service ids for
1040+
templating loaders.
1041+
1042+
packages
1043+
........
1044+
8701045
translator
8711046
~~~~~~~~~~
8721047

@@ -891,6 +1066,8 @@ For more details, see :doc:`/book/translation`.
8911066
validation
8921067
~~~~~~~~~~
8931068

1069+
.. _validation.cache:
1070+
8941071
cache
8951072
.....
8961073

@@ -916,6 +1093,7 @@ translation_domain
9161093

9171094
The translation domain that is used when translating validation constraint
9181095
error messages.
1096+
9191097
.. _`protocol-relative`: http://tools.ietf.org/html/rfc3986#section-4.2
9201098
.. _`PhpStormOpener`: https://github.com/pinepain/PhpStormOpener
9211099
.. _`egulias/email-validator`: https://github.com/egulias/EmailValidator

0 commit comments

Comments
 (0)