aedart/laravel-config
最新稳定版本:1.1.0
Composer 安装命令:
composer require aedart/laravel-config
包简介
Getter and Setter package for a Laravel configuration repository instance. It serves as an alternative to the 'Config' facade.
README 文档
README
Getter and Setter package for a Laravel configuration repository instance. It serves as an alternative to the Config facade.
Contents
[TOC]
When to use this
When your components needs to be make us of some kind of configuration. Or if you component needs to make use of Laravel's specific configuration.
How to install
For Laravel version 5.0.x
#!console
composer require aedart/laravel-config 1.0.*
This package uses composer. If you do not know what that is or how it works, I recommend that you read a little about, before attempting to use this package.
Quick start
Provided that you have an interface, e.g. for a command, you can extend the config-aware interface;
#!php
<?php
use Aedart\Laravel\Config\Interfaces\ConfigAware;
interface ICommand extends ConfigAware {
// ... Remaining interface implementation not shown ...
}
In your concrete implementation, you simple use the config-traits;
#!php
<?php
use Aedart\Laravel\Config\Traits\ConfigTrait;
class DoSomethingCommand implements ICommand {
use ConfigTrait;
// ... Remaining implementation not shown ...
}
Default Configuration Repository instance
The ConfigTrait will by default return the current running Laravel configuration repository instance, if any is available, and provided that your component is running inside a Laravel application.
However, if none is available (not running inside a Laravel Application), a default empty Illuminate\Contracts\Config\Repository instance is returned instead.
Default Configuration Repository Validation
By default, the ConfigTrait will always assume that the specified configuration repository instance is valid. However, if you need to ensure that specific configuration has been set or
certain entries are available, or some other kind of configuration-specific validation, then you can do so, by overriding the isConfigValid() method.
#!php
<?php
use Aedart\Laravel\Config\Traits\ConfigTrait;
use Illuminate\Contracts\Config\Repository;
class DoSomethingCommand implements ICommand {
use ConfigTrait;
public function isConfigValid(Repository $repository){
// In this example, a configuration repository is only valid
// if there is a database.default entry
return $repository->has('database.default'));
}
// ... Remaining implementation not shown ...
}
Acknowledgement
Taylor Otwell et al. for one of the best PHP frameworks ever created.
License
BSD-3-Clause, Read the LICENSE file included in this package
aedart/laravel-config 适用场景与选型建议
aedart/laravel-config 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 30 次下载、GitHub Stars 达 0, 最近一次更新时间为 2015 年 04 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「config」 「utility」 「helper」 「laravel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 aedart/laravel-config 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 aedart/laravel-config 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 aedart/laravel-config 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Datetime helpers for timezone handling
A Zend Framework module to quickly and easily set PHP settings.
A collection of enhancements and utilities for the Silverstripe UserForms module
Library with classes to help you do batch.
Extends TYPO3 EXT:seo hreflang functionality
PHP7 utility classes
统计信息
- 总下载量: 30
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 16
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-04-07