@@ -69,12 +69,6 @@ Configuration
69
69
* `gc_probability `_
70
70
* `gc_maxlifetime `_
71
71
* `save_path `_
72
- * `assets `_
73
- * `base_path `_
74
- * `base_urls `_
75
- * `packages `_
76
- * `version `_
77
- * `version_format `_
78
72
* `templating `_
79
73
* `hinclude_default_template `_
80
74
* :ref: `form <reference-templating-form >`
@@ -814,7 +808,7 @@ start and depends on `gc_divisor`_ and `gc_probability`_.
814
808
save_path
815
809
.........
816
810
817
- **type **: ``string `` **default **: ``%kernel.cache_dir %/sessions ``
811
+ **type **: ``string `` **default **: ``%kernel.cache.dir %/sessions ``
818
812
819
813
This determines the argument to be passed to the save handler. If you choose
820
814
the default file handler, this is the path where the session files are created.
@@ -856,263 +850,11 @@ setting the value to ``null``:
856
850
),
857
851
));
858
852
859
- assets
860
- ~~~~~~
861
-
862
- .. _reference-assets-base-path :
863
-
864
- base_path
865
- .........
866
-
867
- **type **: ``string ``
868
-
869
- This option allows you to define a base path to be used for assets:
870
-
871
- .. configuration-block ::
872
-
873
- .. code-block :: yaml
874
-
875
- # app/config/config.yml
876
- framework :
877
- # ...
878
- assets :
879
- base_path : ' /images'
880
-
881
- .. code-block :: xml
882
-
883
- <!-- app/config/config.xml -->
884
- <?xml version =" 1.0" encoding =" UTF-8" ?>
885
- <container xmlns =" http://symfony.com/schema/dic/services"
886
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
887
- xmlns : framework =" http://symfony.com/schema/dic/symfony"
888
- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
889
- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
890
-
891
- <framework : config >
892
- <framework : assets base_path =" /images" />
893
- </framework : config >
894
- </container >
895
-
896
- .. code-block :: php
897
-
898
- // app/config/config.php
899
- $container->loadFromExtension('framework', array(
900
- // ...
901
- 'assets' => array(
902
- 'base_path' => '/images',
903
- ),
904
- ));
905
-
906
- .. _reference-templating-base-urls :
907
- .. _reference-assets-base-urls :
908
-
909
- base_urls
910
- .........
911
-
912
- **type **: ``array ``
913
-
914
- This option allows you to define base URLs to be used for assets.
915
- If multiple base URLs are provided, Symfony will select one from the
916
- collection each time it generates an asset's path:
917
-
918
- .. configuration-block ::
919
-
920
- .. code-block :: yaml
921
-
922
- # app/config/config.yml
923
- framework :
924
- # ...
925
- assets :
926
- base_urls :
927
- - ' http://cdn.example.com/'
928
-
929
- .. code-block :: xml
930
-
931
- <!-- app/config/config.xml -->
932
- <?xml version =" 1.0" encoding =" UTF-8" ?>
933
- <container xmlns =" http://symfony.com/schema/dic/services"
934
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
935
- xmlns : framework =" http://symfony.com/schema/dic/symfony"
936
- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
937
- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
938
-
939
- <framework : config >
940
- <framework : assets base-url =" http://cdn.example.com/" />
941
- </framework : config >
942
- </container >
943
-
944
- .. code-block :: php
945
-
946
- // app/config/config.php
947
- $container->loadFromExtension('framework', array(
948
- // ...
949
- 'assets' => array(
950
- 'base_urls' => array('http://cdn.example.com/'),
951
- ),
952
- ));
953
-
954
- packages
955
- ........
956
-
957
- You can group assets into packages, to specify different base URLs for them:
958
-
959
- .. configuration-block ::
960
-
961
- .. code-block :: yaml
962
-
963
- # app/config/config.yml
964
- framework :
965
- # ...
966
- assets :
967
- packages :
968
- avatars :
969
- base_urls : ' http://static_cdn.example.com/avatars'
970
-
971
- .. code-block :: xml
972
-
973
- <!-- app/config/config.xml -->
974
- <?xml version =" 1.0" encoding =" UTF-8" ?>
975
- <container xmlns =" http://symfony.com/schema/dic/services"
976
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
977
- xmlns : framework =" http://symfony.com/schema/dic/symfony"
978
- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
979
- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
980
-
981
- <framework : config >
982
- <framework : assets >
983
- <framework : package
984
- name =" avatars"
985
- base-url =" http://static_cdn.example.com/avatars" />
986
- </framework : assets >
987
- </framework : config >
988
- </container >
989
-
990
- .. code-block :: php
991
-
992
- // app/config/config.php
993
- $container->loadFromExtension('framework', array(
994
- // ...
995
- 'assets' => array(
996
- 'packages' => array(
997
- 'avatars' => array(
998
- 'base_urls' => 'http://static_cdn.example.com/avatars',
999
- ),
1000
- ),
1001
- ),
1002
- ));
1003
-
1004
- Now you can use the ``avatars `` package in your templates:
1005
-
1006
- .. configuration-block :: php
1007
-
1008
- .. code-block :: html+twig
1009
-
1010
- <img src="{{ asset('...', 'avatars') }}">
1011
-
1012
- .. code-block :: html+php
1013
-
1014
- <img src="<?php echo $view['assets']->getUrl('...', 'avatars') ?>">
1015
-
1016
- Each package can configure the following options:
1017
-
1018
- * :ref: `base_path <reference-assets-base-path >`
1019
- * :ref: `base_urls <reference-assets-base-urls >`
1020
- * :ref: `version <reference-framework-assets-version >`
1021
- * :ref: `version_format <reference-assets-version-format >`
853
+ templating
854
+ ~~~~~~~~~~
1022
855
1023
856
.. _reference-templating-cache :
1024
857
1025
- version
1026
- .......
1027
-
1028
- **type **: ``string ``
1029
-
1030
- This option is used to *bust * the cache on assets by globally adding a query
1031
- parameter to all rendered asset paths (e.g. ``/images/logo.png?v2 ``). This
1032
- applies only to assets rendered via the Twig ``asset `` function (or PHP
1033
- equivalent) as well as assets rendered with Assetic.
1034
-
1035
- For example, suppose you have the following:
1036
-
1037
- .. configuration-block ::
1038
-
1039
- .. code-block :: html+twig
1040
-
1041
- <img src="{{ asset('images/logo.png') }}" alt="Symfony!" />
1042
-
1043
- .. code-block :: php
1044
-
1045
- <img src =" <?php echo $view['assets']->getUrl('images/logo.png') ?>" alt =" Symfony!" />
1046
-
1047
- By default, this will render a path to your image such as ``/images/logo.png ``.
1048
- Now, activate the ``version `` option:
1049
-
1050
- .. configuration-block ::
1051
-
1052
- .. code-block :: yaml
1053
-
1054
- # app/config/config.yml
1055
- framework :
1056
- # ...
1057
- assets :
1058
- version : ' v2'
1059
-
1060
- .. code-block :: xml
1061
-
1062
- <!-- app/config/config.xml -->
1063
- <?xml version =" 1.0" encoding =" UTF-8" ?>
1064
- <container xmlns =" http://symfony.com/schema/dic/services"
1065
- xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
1066
- xmlns : framework =" http://symfony.com/schema/dic/symfony"
1067
- xsi : schemaLocation =" http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
1068
- http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd" >
1069
-
1070
- <framework : config >
1071
- <framework : assets version =" v2" />
1072
- </framework : config >
1073
- </container >
1074
-
1075
- .. code-block :: php
1076
-
1077
- // app/config/config.php
1078
- $container->loadFromExtension('framework', array(
1079
- // ...
1080
- 'assets' => array(
1081
- 'version' => 'v2',
1082
- ),
1083
- ));
1084
-
1085
- Now, the same asset will be rendered as ``/images/logo.png?v2 `` If you use
1086
- this feature, you **must ** manually increment the ``version `` value
1087
- before each deployment so that the query parameters change.
1088
-
1089
- It's also possible to set the version value on an asset-by-asset basis (instead
1090
- of using the global version - e.g. ``v2 `` - set here). See
1091
- :ref: `Versioning by Asset <book-templating-version-by-asset >` for details.
1092
-
1093
- You can also control how the query string works via the `version_format `_
1094
- option.
1095
-
1096
- .. tip ::
1097
-
1098
- As with all settings, you can use a parameter as value for the
1099
- ``version ``. This makes it easier to increment the cache on each
1100
- deployment.
1101
-
1102
- .. _reference-templating-version-format :
1103
- .. _reference-assets-version-format :
1104
-
1105
- version_format
1106
- ..............
1107
-
1108
- **type **: ``string `` **default **: ``%%s?%%s ``
1109
-
1110
- This specifies a :phpfunction: `sprintf ` pattern that will be used with the
1111
- `version `_ option to construct an asset's path. By default, the pattern
1112
- adds the asset's version as a query string. For example, if
1113
- ``version_format `` is set to ``%%s?version=%%s `` and ``version ``
1114
- is set to ``5 ``, the asset's path would be ``/images/logo.png?version=5 ``.
1115
- =======
1116
858
cache
1117
859
.....
1118
860
@@ -1129,21 +871,13 @@ is disabled.
1129
871
engines
1130
872
.......
1131
873
1132
- Some CDN's do not support cache-busting via query strings, so injecting
1133
- the version into the actual file path is necessary. Thankfully,
1134
- ``version_format `` is not limited to producing versioned query
1135
- strings.
1136
- =======
1137
874
**type **: ``string[] `` / ``string `` **required **
1138
875
1139
876
The Templating Engine to use. This can either be a string (when only one
1140
877
engine is configured) or an array of engines.
1141
878
1142
879
At least one engine is required.
1143
880
1144
- templating
1145
- ~~~~~~~~~~
1146
-
1147
881
hinclude_default_template
1148
882
.........................
1149
883
@@ -1231,8 +965,6 @@ Assume you have custom global form themes in
1231
965
1232
966
See :ref: `book-forms-theming-global ` for more information.
1233
967
1234
- .. _reference-templating-cache :
1235
- =======
1236
968
loaders
1237
969
.......
1238
970
@@ -1616,8 +1348,6 @@ cache
1616
1348
The service that is used to persist class metadata in a cache. The service
1617
1349
has to implement the :class: `Symfony\\ Component\\ Validator\\ Mapping\\ Cache\\ CacheInterface `.
1618
1350
1619
- .. _reference-validation-enable_annotations :
1620
-
1621
1351
enable_annotations
1622
1352
..................
1623
1353
@@ -1833,21 +1563,6 @@ Full Default Configuration
1833
1563
serializer :
1834
1564
enabled : false
1835
1565
1836
- # assets configuration
1837
- assets :
1838
- base_path : ~
1839
- base_urls : []
1840
- version : ~
1841
- version_format : ' %%s?%%s'
1842
- packages :
1843
-
1844
- # Prototype
1845
- name :
1846
- base_path : ~
1847
- base_urls : []
1848
- version : ~
1849
- version_format : ' %%s?%%s'
1850
-
1851
1566
# templating configuration
1852
1567
templating :
1853
1568
hinclude_default_template : ~
@@ -1896,6 +1611,7 @@ Full Default Configuration
1896
1611
file_cache_dir : ' %kernel.cache_dir%/annotations'
1897
1612
debug : ' %kernel.debug%'
1898
1613
1614
+ .. _`protocol-relative` : http://tools.ietf.org/html/rfc3986#section-4.2
1899
1615
.. _`HTTP Host header attacks` : http://www.skeletonscribe.net/2013/05/practical-http-host-header-attacks.html
1900
1616
.. _`Security Advisory Blog post` : https://symfony.com/blog/security-releases-symfony-2-0-24-2-1-12-2-2-5-and-2-3-3-released#cve-2013-4752-request-gethost-poisoning
1901
1617
.. _`Doctrine Cache` : http://docs.doctrine-project.org/projects/doctrine-common/en/latest/reference/caching.html
0 commit comments