elcweb/keyvaluestore-bundle

让您轻松访问和设置键值

安装次数: 1,301

依赖者: 0

建议者: 1

安全: 0

星标: 2

关注者: 2

分支: 4

开放问题: 4

类型:symfony-bundle

v2.0.3 2016-06-28 16:12 UTC

This package is auto-updated.

Last update: 2024-09-08 01:15:12 UTC


README

Latest Stable Version Total Downloads Travis

安装

步骤 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 标准版 的基本项目中重现它,以便包的开发者通过简单地克隆它并遵循一些步骤来重现问题。