vpg/titon.common
最新稳定版本:v1.4
Composer 安装命令:
composer require vpg/titon.common
包简介
The Titon common package provides global functionality like class traits and augmentation as well as dependency and configuration management.
README 文档
README
Provides common functionality for external packages, such as dependency management through registries and containers, global configuration with a static configuration management layer, and a base class for all modular abstract classes to inherit.
On top of those features, the common package provides multiple traits that allow horizontal inheritance of powerful patterns that solve basic use cases, like caching within class instances, class configurations, class dependencies, and more. Classes can be further enhanced through augmentations, which are self contained inner classes.
For example, we can inherit common class functionality like serialization, configuration, and more.
class Object extends Titon\Common\Base { use Titon\Common\Attachable, \\ Provides lazy-loaded inner class dependencies Titon\Common\Cacheable, \\ Provides memoization (method caching) Titon\Common\Instanceable; \\ Provides multiton instance support }
We can also lazy-load dependencies through the registry.
use Titon\Common\Registry; Registry::register('foo.bar', function() { return new Foo\Bar(); }); $foobar = Registry::get('foo.bar'); $foobar = Registry::factory('Foo\Bar'); // by namespace
And finally, configuration management has never been easier.
use Titon\Common\Config; Config::set('foo.bar', 'baz'); $baz = Config::get('foo.bar');
Features
Base- Primary base classTraits- Horizontal inheritanceAugments- Class functionality encapsulationRegistry- Static dependency containerContainer- Dependency containerConfig- Configuration management
Dependencies
UtilityIo(optional for Config)
Requirements
- PHP 5.4.0
统计信息
- 总下载量: 12.42k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 1
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-2-Clause
- 更新时间: 2015-01-01