Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kaliber5/settings-bundle
symfony bundle to handle application settings
https://github.com/kaliber5/settings-bundle
Last synced: about 2 months ago
JSON representation
symfony bundle to handle application settings
- Host: GitHub
- URL: https://github.com/kaliber5/settings-bundle
- Owner: kaliber5
- Created: 2020-12-03T13:37:26.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-03-31T07:40:26.000Z (almost 3 years ago)
- Last Synced: 2024-04-13T08:10:27.802Z (9 months ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 1
- Watchers: 4
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Installation
============Make sure Composer is installed globally, as explained in the
[installation chapter](https://getcomposer.org/doc/00-intro.md)
of the Composer documentation.Applications that use Symfony Flex
----------------------------------Open a command console, enter your project directory and execute:
```console
$ composer require kaliber5/settings-bundle
```Continue with Step 3.
Applications that don't use Symfony Flex
----------------------------------------### Step 1: Download the Bundle
Open a command console, enter your project directory and execute the
following command to download the latest stable version of this bundle:```console
$ composer require kaliber5/settings-bundle
```### Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the `config/bundles.php` file of your project:```php
// config/bundles.phpreturn [
// ...
Kaliber5\SettingsBundle\Kaliber5SettingsBundle::class => ['all' => true],];
```### Step 3: Generate Migrations
Then, adjust your database structure to add the new entities.
```console
$ bin/console doctrine:migrations:diff
$ bin/console doctrine:migrations:migrate
```### Step 4: Usage
If you're already using sonata admin-bundle, the settings admin will be available immediatly to add settings
in your code you can retrieve the settings by using the `SettingsProvider`:
```php
// ...
use Kaliber5\SettingsBundle\Provider\SettingsProvider;
// ... in some class
/**
* @var SettingsProvider
*/
private $settingsProvider;
// ...in some method
$mixed = $this->settingsProvider->getSettingValuesByCode('unique_code_of_setting');
```