navalex / config-bundle
Symfony NavalexConfigBundle
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5.9
- doctrine/doctrine-bundle: ^1.6
- doctrine/orm: ^2.5
- incenteev/composer-parameter-handler: ^2.0
- knplabs/knp-paginator-bundle: ^2.8
- sensio/distribution-bundle: ^5.0.19
- sensio/framework-extra-bundle: ^5.0.0
- symfony/monolog-bundle: ^3.1.0
- symfony/polyfill-apcu: ^1.0
- symfony/swiftmailer-bundle: ^2.6.4
- symfony/symfony: 3.4.*
- twig/twig: ^1.0||^2.0
Requires (Dev)
- sensio/generator-bundle: ^3.0
- symfony/phpunit-bridge: ^3.0
This package is not auto-updated.
Last update: 2025-04-23 19:24:50 UTC
README
Allows you to create configurations that can be used in your project (Twig and Controller services) and manage them through an admin panel divided into two parts:
- Configuration forms divided in category and fieldset to edit values of your configs:
- Create Category, Fieldset and Configuration field for you forms
Installation
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
$ composer require navalex/config-bundle
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:
$ composer require navalex/config-bundle
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the app/AppKernel.php
file of your project:
<?php // app/AppKernel.php // ... class AppKernel extends Kernel { public function registerBundles() { $bundles = array( // ... new Knp\Bundle\PaginatorBundle\KnpPaginatorBundle(), new Navalex\ConfigBundle\NavalexConfigBundle(), ); // ... } // ... }
Step 3: Update database
To make the plugin work, you need to update database table by entering the following command:
$ php bin/console doctrine:schema:update --force
Configuration
Step 1: Enable routes
Open app/config/routing.yml
and add:
# app/config/routing.yml navalex.config_bundle: resource: '@NavalexConfigBundle/Resources/config/routing.yml'
(Optional) Step 2: Protect admin panel
If you want to restrict access to the panel to a specific role you can something like that (restrict access for ROLE_ADMIN only) in app/config/security.yml
:
# app/config/security.yml security: # ... role_hierarchy: # ... ROLE_ADMIN: ROLE_USER ROLE_SUPER_ADMIN: ROLE_ADMIN access_control: # ... - { path: ^/admin/, role: ROLE_ADMIN }
Step 3: Update cache
Once evrything is done, update symfony cache to access to the panel
$ php bin/console cache:clear or $ php bin/console cache:clear --env=prod
Usage
Step 1: Create configurations
Go to http://<your_website>/admin/config/admin/config/conf
Here you can create Form Category, then give it fieldsets to organize your form, and finaly create configuration. Here a detail of configuration fields:
- Name: Admin form label for this configuration
- Code: Unique code to call the configuration in Twig and Controller
- Category/Field: Select form and fieldset for this configuration
- Type: What kind of field will be the configuration By default, the bundle give the value "data" to every new configuration.
Step 2: Edit configurations value
You'll now see your configurations category form appear on the navbar of the panel. Just go on it and enjoy !
Step 3: Call the configuration in your project
In Controller:
$configs = $this->get('navalex_config.config'); $configs->get('<your_configuration_code>');
In Twig:
{{ getConfig('<your_configuration_code>') }}
Incoming Features
- Translation domain for configuration label
- New complexe field types:
- Array (with text inputs added with ajax button)
- Image (with automatique upload and naming)
- Complete Navapanel Dashboard
- Order Form Category in the panel
- Get config from ajax with API url like http://<your_website>/config/<code> and JSON return
- Customize field types in symfony configuration
- ...
License
This bundle is under the MIT license. See the complete license in the bundle