twosuperior / registry
此包已被废弃,不再维护。没有建议的替代包。
Laravel 4 注册表管理器,用于存储应用程序特定设置
2.1.1
2018-06-04 10:48 UTC
Requires
- php: >=5.3.0
Requires (Dev)
- illuminate/support: 4.0.x
- mockery/mockery: 0.8.0
- phpunit/phpunit: 3.7.*
- satooshi/php-coveralls: dev-master
README
Laravel 4/5 注册表管理器,用于存储应用程序特定设置。结合了 https://github.com/theelphie/registry 和 https://github.com/torann/laravel-4-registry。感谢 @Torann 和 @theelphie。
还要感谢 @srlabs,他撰写了有关 Laravel 5 包开发 的博客
Laravel 5 的安装
将以下内容添加到您的 composer.json
文件中
{ "require": { "twosuperior/registry": "2.0.x" } }
Laravel 4 的安装
将以下内容添加到您的 composer.json
文件中
{ "require": { "twosuperior/registry": "1.0.x" } }
Laravel 5 安装后的设置
将服务提供者和别名添加到您的 app/config/app.php
'providers' => [ Twosuperior\Registry\RegistryServiceProvider::class, ], 'Registry' => Twosuperior\Registry\Facades\Registry::class,
运行 php artisan vendor:publish
Laravel 4 安装后的设置
将服务提供者和别名添加到您的 app/config/app.php
'providers' => array( 'Twosuperior\Registry\RegistryServiceProvider', ), 'Registry' => 'Twosuperior\Registry\Facades\Registry',
运行 php artisan config:publish "twosuperior\registry"
运行 php artisan migrate --package="twosuperior\registry"
以安装注册表表
用法
从注册表中检索项目
Registry::get('foo'); \\will return null if key does not exists Registry::get('foo.bar'); \\will return null if key does not exists Registry::get('foo', 'undefine') \\will return undefine if key does not exists
将项目存储到注册表中
Registry::set('foo', 'bar'); Registry::set('foo', array('bar' => 'foobar')); Registry::get('foo'); \\bar Registry::get('foo.bar'); \\foobar
从注册表中删除项目
Registry::forget('foo'); Registry::forget('foo.bar');
清除缓存并重新加载注册表
Registry::clear();
刷新注册表表
Registry::flush();
转储项目的所有值
Registry::dump('foo');
从注册表中检索所有项目
Registry::all();
批量更新
$settings = Input::only('name', 'address', 'email'); Registry::store($settings);