weprovide / symfony-config-bundle
The We Provide Config Bundle for Symfony adds an interface into the Sonata/AdminBundle in which you can configure application parameters.
Installs: 100
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 13
Forks: 0
Open Issues: 0
Type:symfony-bundle
This package is auto-updated.
Last update: 2023-07-16 01:16:36 UTC
README
The We Provide Config Bundle for Symfony adds an interface into the Sonata/AdminBundle in which you can configure application parameters.
Your Symfony application has a dozen of config values and parameters set in your app/config
folder, spread in different (or one) yml
files. If you need to be able to change the value of these configs at runtime without manually editing these files you can use We Provide's Config Bundle.
Let's for example say that you want to enable or disable a maintenance mode. You can do this now without having to log into your server, change the yml file and clear the cache, simply by changing the value with We Provide's Config Bundle.
In the image shown above you'll see a couple of parameters configured with the interface. This will output a parameters.yml
which looks like below.
parameters: boolean.param: true integer.param: 13 string.param: 'This a test string value' choice.param: choice-2
You can use these parameters like you normally would in your Symfony application. Either in a controller with
$this->getParameter('boolean.param');
or even in other parameters or config values with
swiftmailer: delivery_addresses: '%string.param%'
Dependencies
This bundle is developed with a Symfony Standard Edition on PHP 7.1 using We Provide's Valet+. Obviously it has dependencies to other projects and/or bundles. Below a list of dependencies, please use the installation guides of these bundles first.
Installation
Install this bundle into your project using Composer.
composer require weprovide/symfony-config-bundle
Enable the bundle by inserting it in your Symfony's AppKernel.php
.
// app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new WeProvide\ConfigBundle\WeProvideConfigBundle(), ); // ... } // ... }
Include the config.yml
and parameters.yml
into your own under the section imports
. You can choose in which order you include these files, depending on where you want to use the parameters.
imports: # ... - { resource: "@WeProvideConfigBundle/Resources/config/config.yml" } - { resource: "@WeProvideConfigBundle/Resources/config/parameters.yml", ignore_errors: true }
Update your database schema with the doctrine command.
bin/console doctrine:schema:update --force
License
This bundle has been released under the MIT license and open for improvements, please share your thoughts which will be much appreciated.
Authors
- Mischa Braam (@mischabraam)
TODO's
- Add event listeners where the client application can hook onto.
- Add list type to be able to config an yml array.