laasti/valitron-provider

为 vlucas/valitron 提供的联盟/容器 v2 服务

v2.0.1 2016-04-21 12:06 UTC

This package is auto-updated.

Last update: 2024-08-29 03:29:45 UTC


README

为 vlucas/valitron 提供的联盟/容器 v2 服务

安装

composer require laasti/valitron-provider

使用方法

$container = new League\Container\Container;
$container->add('config', [
    'valitron' =>[
        'locale' => 'fr',//if not specified, attempts to use config.locale in the container, defaults to en,
        'locales_dir' => __DIR__,//defaults, to Valitron's language files directory
        //Additional rules to add to Valitron, any php callbacks are accepted
        'rules' => [
            ['my_rule', 'my_callback', 'My message']
        ]
    ]
]);
$container->addServiceProvider('Laasti\ValitronProvider\ValitronProvider');

//The arguments are the same as Valitron's constructor
$validator = $container->get('Valitron\Validator', [$data]);

贡献

  1. 复制它!
  2. 创建你的功能分支: git checkout -b my-new-feature
  3. 提交你的更改: git commit -am '添加一些功能'
  4. 推送到分支: git push origin my-new-feature
  5. 提交 pull request :D

历史

更多信息请参阅 CHANGELOG.md。

致谢

作者:Sonia Marquette (@nebulousGirl)

许可证

在 MIT 许可证下发布。请参阅 LICENSE.txt 文件。