8000 Complete rewrote FrameworkBundle config reference by wouterj · Pull Request #4736 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Complete rewrote FrameworkBundle config reference #4736

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Some final fixes
  • Loading branch information
wouterj committed Mar 26, 2015
commit bb9a1e7c04b570509c94f58bf32c22f1f3a3ce57
16 changes: 8 additions & 8 deletions cookbook/profiler/storage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ uses MySQL as the storage for the profiler with a lifetime of one hour:
));

The :doc:`HttpKernel component </components/http_kernel/introduction>` currently
supports the following profiler storage implementations:
supports the following profiler storage drivers:

* :class:`Symfony\\Component\\HttpKernel\\Profiler\\FileProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MemcachedProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MemcacheProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MongoDbProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\MysqlProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\RedisProfilerStorage`
* :class:`Symfony\\Component\\HttpKernel\\Profiler\\SqliteProfilerStorage`
* file
* sqlite
* mysql
* mongodb
* memcache
* memcached
* redis
133 changes: 58 additions & 75 deletions reference/configuration/framework.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,7 @@ trusted_proxies

**type**: ``array``

Configures the IP addresses that should be trusted as proxies. It becomes the
service container parameter called ``kernel.trusted_proxies``.
Configures the IP addresses that should be trusted as proxies.

.. seealso::

Expand Down Expand Up @@ -211,23 +210,22 @@ test

**type**: ``boolean``

If this configuration parameter is present (and not ``false``), then the
services related to testing your application (e.g. ``test.client``) are loaded.
This setting should be present in your ``test`` environment (usually via
If this configuration setting is present (and not ``false``), then the services
related to testing your application (e.g. ``test.client``) are loaded. This
setting should be present in your ``test`` environment (usually via
``app/config/config_test.yml``).

.. seealso::

For more information, see :doc:`/book/testing`.
For more information, see :doc:`/book/testing`.

default_locale
~~~~~~~~~~~~~~

**type**: ``string`` **default**: ``'en'``

The default locale is used if no ``_locale`` routing parameter has been set. It
becomes the service container parameter named ``kernel.default_locale`` and it
is also available with the
is available with the
:method:`Request::getDefaultLocale <Symfony\\Component\\HttpFoundation\\Request::getDefaultLocale>`
method.

Expand All @@ -252,14 +250,13 @@ might have been manipulated by an attacker.
You can read "`HTTP Host header attacks`_" for more information about these
kinds of attacks.

The Symfony :method:`Request::getHost()
<Symfony\\Component\\HttpFoundation\\Request:getHost>` method might be
vulnerable to some of these attacks because it depends on the configuration of
your web server. One simple solution to avoid these attacks is to whitelist the
hosts that your Symfony application can respond to. That's the purpose of this
``trusted_hosts`` option. If the incoming request's hostname doesn't match one
in this list, the application won't respond and the user will receive a 500
response.
The Symfony :method:`Request::getHost() <Symfony\\Component\\HttpFoundation\\Request:getHost>`
method might be vulnerable to some of these attacks because it depends on the
configuration of your web server. One simple solution to avoid these attacks is
to whitelist the hosts that your Symfony application can respond to. That's the
purpose of this ``trusted_hosts`` option. If the incoming request's hostname
doesn't match one in this list, the application won't respond and the user will
receive a 500 response.

.. configuration-block::

Expand Down Expand Up @@ -293,8 +290,8 @@ response.
'trusted_hosts' => array('acme.com', 'acme.org'),
));

Hosts can also be configured using regular expressions (e.g.
``.*\.?acme.com$``), which make it easier to respond to any subdomain.
Hosts can also be configured using regular expressions (e.g. ``.*\.?acme.com$``),
which make it easier to respond to any subdomain.

In addition, you can also set the trusted hosts in the front controller using
the ``Request::setTrustedHosts()`` method::
Expand Down Expand Up @@ -349,8 +346,7 @@ enabled
**type**: ``boolean`` **default**: ``true``

Whether to enable the CSRF support in forms or not. Setting this option to
``true`` requires the `secret`_ to be set and `session`_ to be enabled. It
becomes the service container parameter named ``form.type_extension.csrf.enabled``.
``true`` requires the `secret`_ to be set and `session`_ to be enabled.

This option will automatically be set to ``true`` when one of the child
settings is configured.
Expand All @@ -364,8 +360,7 @@ field_name

**type**: ``string`` **default**: ``'_token'``

The name of the hidden field containing the CSRF token in the form. It becomes
the service container parameter named ``form.type_extension.csrf.field_name``.
The name of the hidden field containing the CSRF token in the form.

esi
~~~
Expand Down Expand Up @@ -444,8 +439,7 @@ path
**type**: ``string`` **default**: ``'/_fragment'``

The path prefix for fragments. The fragment listener will only be executed
when the request starts with this path. It becomes the service con 10000 tainer
parameter called ``fragment.path``.
when the request starts with this path.

profiler
~~~~~~~~
Expand All @@ -469,8 +463,8 @@ and ``test`` environments.
.. note::

The profiler works independently from the Web Developer Toolbar, see the
:doc:`WebProfilerBundle configuration
</reference/configuration/web_profiler>` on how to disable/enable it.
:doc:`WebProfilerBundle configuration </reference/configuration/web_profiler>`
on how to disable/enable the toolbar.

collect
.......
Expand All @@ -484,9 +478,10 @@ collect
**type**: ``boolean`` **default**: ``true``

This option configures the way the profiler behaves when it is enabled. If set
to ``true``, the profiler collects data for all requests. If you want to only
collect information on-demand, you can set the ``collect`` flag to ``false``
and activate the data collectors manually::
to ``true``, the profiler collects data for all requests (unless you configure
otherwise, like a custom `matcher`_). If you want to only collect information
on-demand, you can set the ``collect`` flag to ``false`` and activate the data
collectors manually::

$profiler->enable();

Expand All @@ -496,67 +491,55 @@ only_exceptions
**type**: ``boolean`` **default**: ``false``

When this is set to ``true``, the profiler will only be enabled when an
exception is thrown during the handling of the request. It becomes the service
container parameter called ``profiler_listener.only_exceptions``.
exception is thrown during the handling of the request.

only_master_requests
....................

**type**: ``boolean`` **default**: ``false``

When this is set to ``true``, the profiler will only be enabled on the master
requests (and not on the subrequests). It becomes the service container
parameter called ``profiler_listener.only_master_requests``.
requests (and not on the subrequests).

dsn
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually have a cookbook entry on this! http://symfony.com/doc/current/cookbook/profiler/storage.html

Perhaps we can unify them a bit - that is a pretty short entry, and it's not great. You listing the valid DSN's below is better than what it does (listing the internal classes used does not seem helpful).

...

**type**: ``string`` **default**: ``'file:%kernel.cache_dir%/profiler'``

The DSN where to save the profiling information. The supported drivers (part
before the colon) are:
The DSN where to store the profiling information.

* file
* sqlite
* mysql
* mongodb
* memcache
* memcached
* redis
.. seealso::

It becomes the service container parameter called ``profiler.storage.dsn``.
See :doc:`/cookbook/profiler/storage` for more information about the
profiler storage.

username
........

**type**: ``string`` **default**: ``''``

When needed, the username for the profiling storage. It becomes the service
container parameter called ``profiler.storage.username``.
When needed, the username for the profiling storage.

password
........

**type**: ``string`` **default**: ``''``

When needed, the password for the profiling storage. It becomes the service
container parameter called ``profiler.storage.password``.
When needed, the password for the profiling storage.

lifetime
........

**type**: ``integer`` **default**: ``86400``

The lifetime of the profiling storage in seconds. The data will be deleted when
the lifetime is expired. It becomes the service container parameter called
``profiler.storage.lifetime``.

the lifetime is expired.

matcher
.......

Matcher options are configured to dynamically enable the profiler. For
instance, based on `ip`_ or :ref:`path <reference-profiler-matcher-path>`.
instance, based on the `ip`_ or :ref:`path <reference-profiler-matcher-path>`.

.. seealso::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should put a short sentence about what this doe before the seealso


Expand Down Expand Up @@ -597,8 +580,6 @@ resource
The path the main routing resource (e.g. a YAML file) that contains the routes
and imports the router should load.

It becomes the service container parameter called ``router.resource``.

type
....

Expand All @@ -615,8 +596,6 @@ http_port

The port for normal http requests (this is used when matching the scheme).

It becomes the service container parameter called ``router.resource``.

https_port
..........

Expand Down Expand Up @@ -650,14 +629,6 @@ The value can be one of:
session
~~~~~~~

storage_id
..........

**type**: ``string`` **default**: ``'session.storage.native'``

The service id used for session storage. The ``session.storage`` service alias
will be set to this service id.

handler_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should put this before storage_id? I get confused about why there are 2 - but it seems like most people will need to modify handler_id - e.g. http://symfony.com/doc/current/cookbook/configuration/pdo_session_storage.html - not storage_id. Also, maybe we can link to http://symfony.com/doc/current/cookbook/configuration/pdo_session_storage.html as an example for handler_id.

..........

Expand All @@ -669,23 +640,38 @@ will be set to this service id.
You can also set it to ``null``, to default to the handler of your PHP
installation.

.. seealso::

You can see an example of the usage of this in
:doc:`/cookbook/configuration/pdo_session_storage`.

storage_id
..........

**type**: ``string`` **default**: ``'session.storage.native'``

The service id used for session storage. The ``session.storage`` service alias
will be set to this service id. This class has to implement
:class:`Symfony\\Component\\HttpFoundation\\Session\\Storage\\SessionStorageInterface`.

name
....

**type**: ``string`` **default**: ``null``

This specifies the name of the session cookie. By default it will use the cookie
name which is defined in the ``php.ini`` with the ``session.name`` directive.
This specifies the name of the session cookie. By default it will use the
cookie name which is defined in the ``php.ini`` with the ``session.name``
directive.

cookie_lifetime
...............

**type**: ``integer`` **default**: ``null``

This determines the lifetime of the session - in seconds. It will use ``null`` by
default, which means ``session.cookie_lifetime`` value from ``php.ini`` will be used.
Setting this value to ``0`` means the cookie is valid for the length of the browser
session.
This determines the lifetime of the session - in seconds. It will use ``null``
by default, which means ``session.cookie_lifetime`` value from ``php.ini`` will
be used. Setting this value to ``0`` means the cookie is valid for the length
of the browser session.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Starting in sentence 2:

The default value - ``null`` - means that the ``sesssion.cookie_lifetime`` value from
``php.ini`` will be used.


cookie_path
...........
Expand Down Expand Up @@ -910,8 +896,7 @@ hinclude_default_template
**type**: ``string`` **default**: ``null``

Sets the content shown during the loading of the fragment or when JavaScript is
disabled. This can be either a template name or the content itself. It becomes
the service container parameter named ``fragment.renderer.hinclude.global_template``.
disabled. This can be either a template name or the content itself.

.. seealso::

Expand Down Expand Up @@ -1019,17 +1004,15 @@ cache
**type**: ``string``

The path to the cache directory for templates. When this is not set, caching is
disabled. It becomes the service container parameter named
``templating.loader.cache.path``.
disabled.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can't be quite right, because that would mean that the SE doesn't cache templates by default (since this key is not present there by default)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is correct. The caching is done by the TwigBundle in the SE, not by the FrameworkBundle. Twig defaults to caching enabled, FrameworkBundle to caching disabled.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So would this only apply in reality to PHP templates? Let's just try to make this note as clear as we can.


engines
.......

**type**: ``string[]`` / ``string`` **required**

The Templating Engine to use. This can either be a string (when only one engine
is configured) or an array of engines. It becomes the service container
parameter named ``templating.engines``.
is configured) or an array of engines.

At least one engine is required.

Expand Down
0