elcweb / keyvaluestore-bundle
让您轻松访问和设置键值
v2.0.3
2016-06-28 16:12 UTC
Requires
- php: >=5.6.1
- 51systems/doctrine-encrypt: ~4.0
- doctrine/dbal: <2.5
- doctrine/doctrine-bundle: ~1.4
- doctrine/orm: ~2.2,>=2.2.3,<2.5
- elcweb/common-bundle: dev-master
- elcweb/doctrine-encrypt-bundle: 0.1.*
- jms/serializer-bundle: dev-master
- stof/doctrine-extensions-bundle: dev-master
- symfony/symfony: >=2.4,<3.0-dev
Requires (Dev)
- phpunit/phpunit: 5.4.*
Suggests
README
安装
步骤 1: 使用 composer 下载
{ "require": { "elcweb/keyvaluestore-bundle": "~2.0" } }
现在运行以下命令让 composer 下载包
$ php composer.phar update elcweb/keyvaluestore-bundle
步骤 2: 启用包
在内核中启用包
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Elcweb\KeyValueStoreBundle\ElcwebKeyValueStoreBundle(), ); }
步骤 3: Doctrine 迁移(可选)
如果您是从 1.x 版本升级,则需要执行迁移。我们建议使用 DoctrineMigration
迁移示例在
DoctrineMigrations/Version20150715164320.php
请确保您的参数 %secret% 是32个字符长。
使用方法
获取值
$ks = $this->get('elcweb.keyvaluestore'); $value = $ks->get('KeyName');
获取以模式开头的所有值
$ks = $this->get('elcweb.keyvaluestore'); $values = $ks->getAll('KeyName'); // If you have a keys called foo.bar and foo.foo this will return an array with key bar and foo
设置值
$ks = $this->get('elcweb.keyvaluestore'); $ks->set('key', 'value', 'optional description');
许可证
此包采用 MIT 许可证。请参阅包中的完整许可证。
Resources/meta/LICENSE
报告问题或功能请求
问题和功能请求在 Github 问题跟踪器 中跟踪。
当报告错误时,最好在基于 Symfony 标准版 的基本项目中重现它,以便包的开发者通过简单地克隆它并遵循一些步骤来重现问题。