weew/app
Composer 安装命令:
composer require weew/app
包简介
Very minimalistic wrapper for a php application.
README 文档
README
Table of contents
Installation
composer require weew/app
Introduction
This package is meant to be used as a barebone for any php applications. It uses the weew/container package for dependency injection, weew/kernel as a kernel where you can register your providers, the weew/eventer package for event handing and the weew/commander package as the command bus. Configuration is handled by the weew/config package.
Please read documentation of different components to see how they work.
Usage
Creating a new app is very simple:
$app = new App('environment'); // or $app = new App(); $app->setEnvironment('environment'); // get depdency injection container $app->getContainer(); // get kernel $app->getKernel(); // get event bus $app->getEventer(); // get command bus $app->getCommander();
You can provide config sources using the config loader.
// get config $app->getConfigLoader() ->addPath('/path/to/config') ->addRuntimeConfig(['some' => 'value']);
Be aware that applications current environment and debug mode will always be available inside the config object.
// "dev" by default $app->getEnvironment(); $app->setEnvironment('test'); // will be set to test $app->getConfig()->get('env'); // false by default $app->getDebug(); $app->setDebug(true); // will be set to true $app->getConfig()->get('debug');
Be aware that config is only available after the application start.
Extensions
There are several extensions available:
统计信息
- 总下载量: 347
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 7
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-07-18