zent / vars-bundle
Symfony2 bundle dynamic parameters
Installs: 611
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: >=5.5
- doctrine/doctrine-bundle: ~1.2
- doctrine/doctrine-cache-bundle: ~1.0
- symfony/symfony: ~2.4 | ~3.0
This package is auto-updated.
Last update: 2025-04-27 11:50:36 UTC
README
Step 1: Download ZentVarsBundle using composer
composer require zent/vars-bundle dev-master
Step 2: Enable the bundle
Enable the bundle in the kernel:
<?php
// app/AppKernel.php
public function registerBundles()
{
$bundles = array(
// ...
new Zent\VarsBundle\ZentVarsBundle(),
// ...
);
}
Step 3: Create your Vars class
// src/AppBundle/Entity/Vars.php
use Zent\VarsBundle\Entity\BaseVars;
class Vars extended BaseVars
{
}
Step 4: Configure the ZentVarsBundle
# app/config/config.yml
zent_vars:
class: AppBunde\Entity\Vars
If you need additional caching:
doctrine_cache:
providers:
zent_vars_query_cache:
type: apc
namespace: query_cache_ns
alias:
- zent_vars.cache
Doc: https://symfony.com/doc/current/bundles/DoctrineCacheBundle/reference.html
Step 5: Update your database schema
Usage
Accessing the User Manager service
$varsManager = $container->get('zent_vars.manager');
$var = $varsManager->getValue('first');
$var = $varsManager->getValue('first', 10); //return '10' if var not found
Twig
{{ vars('first') }}
Command Line Tools
php app/console zent:vars:create email_owner test@example.com "Email владельца"
php app/console zent:vars:update email_owner test@test.com
php app/console zent:vars:delete email_owner
php app/console zent:vars:list