Download the PHP package 2lenet/config-bundle without Composer
On this page you can find all versions of the php package 2lenet/config-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download 2lenet/config-bundle
More information about 2lenet/config-bundle
Files in 2lenet/config-bundle
Package config-bundle
Short Description Config Bundle
License MIT
Homepage https://www.2le.net
Informations about the package config-bundle
ConfigBundle
Symfony bundle that gives you an easy configuration for your app. Perfect to use with the famous CRUD Crudit
- Installation
- Customization
- Usage
- Initialise new configurations (Warm-up)
Installation
The bundle is not yet on packagist make sure to add the following to your composer.json
file:
Install with composer:
The bundle is flexible and built to suit your project it is shiped only with trait to use in your own config entity.
You will also get a Symfony Repository ready to use.
Create in your entity directory the class Config
it has to implements the ConfigInterface if no customization is
needed you can use:
Your repository file has to extend the ConfigRepository from the bundle:
In your project add the folowing to the config file: /config/packages/doctrine.yaml
In /config/routes.yaml
add:
You can then create a migration
Check the migration file created and ask doctrine to execute the migration :
You are ready to go!
Customization
If you need more options or entity fields you can add them in your entity class:
You may also need more options than the ones in the Repository file, in that case create a new repository class in your project. Don't forget to update the namspace used in your entity (see previous exemple).
Usage
General overview
To use the bundle, inject in your services the config repository and use one of the available methods. The bundle will check if the configuration exist otherwise a new configuration will be created.
Supported configurations
The bundle offers support for configuration in the following formats :
- boolean
- string
- text
- integer
Available methods
Twig integration
Initialise new configurations (Warm-up)
A command allows you to initialise new configurations. We suggest to execute it everytime your app starts.
To configure the default values, create a class that implements WarmupInterface.
Do not use set*(), because it will overwrite defined configurations.
All versions of config-bundle with dependencies
2lenet/crudit-bundle Version *
symfony/framework-bundle Version ^6.0|^7.0
twig/twig Version ^3.4