Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[RFR] Added "How to Organize Configuration Files" cookbook #3885

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

Merged
merged 9 commits into from
Aug 16, 2014
Prev Previous commit
Next Next commit
Removed the "Directory Loading" section because it doesn't work out o…
…f the box
  • Loading branch information
javiereguiluz committed Jun 3, 2014
commit be414e046c8d7338af99aa408dfd1caf2c56c6bf
48 changes: 0 additions & 48 deletions 48 cookbook/configuration/configuration_organization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -338,54 +338,6 @@ When the configuration values are dynamic, you can use the PHP configuration
file to execute your own logic. In addition, you can define your own services
to load configuration from databases and web services.
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe suggest here extending or implementing a particular interface or using the ClosureLoader.

Copy link
Member

Choose a reason for hiding this comment

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

[...] to load configurations [...]

Copy link
Member

Choose a reason for hiding this comment

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

[...] databases or web servers.


Directory Loading
~~~~~~~~~~~~~~~~~

Splitting configuration into lots of smaller files can rapidly become cumbersome
when importing those files from the main configuration file. Avoid these problems
by loading an entire directory:

.. configuration-block::

.. code-block:: yaml

# app/config/config.yml
imports:
- { resource: 'bundles/' }
- { resource: 'services/' }

# ...

.. code-block:: xml

<!-- app/config/config.xml -->
<?xml version="1.0" encoding="UTF-8" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd
http://symfony.com/schema/dic/symfony http://symfony.com/schema/dic/symfony/symfony-1.0.xsd">

<imports>
<import resource="bundles/" />
<import resource="services/" />
</imports>

<!-- ... -->
</container>

.. code-block:: php

// app/config/config.php
$loader->import('bundles/');
$loader->import('services/');

// ...


The Config component will recursively look in the ``bundles/`` and ``services/``
directories and it will load any supported file format (``.yml``, ``.xml``,
``.php``, ``.ini``).

Global Configuration Files
~~~~~~~~~~~~~~~~~~~~~~~~~~

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.