radmen/fatso
Composer 安装命令:
composer require radmen/fatso
包简介
Silex fat cousin
README 文档
README
Silex is great micro-framework, but it's sometimes just too simple. Fatso is his fat cousin.
It provides very simple, basic classes and automates few things.
Fatso can:
- detect environment based on host name
- load config files (plain PHP arrays, or YAML) and merge thme with their env variants
- perform simple bootstrap of Silex providers
- load routes from config file
Fatso is ugly.
Fast class overview
TL;DR - goto: demo
Config
Config loads files from $app['config.dir'] path.
It also uses env name to merge basic config with it's env variant.
Config can load PHP, or YML files.
Example:
config/foo.yml:
foo: name: bar env: null
config/foo_dev.php:
<?php return array( 'foo' => array( 'env' => 'dev', ), );
$config = $app['config']->get('foo'); /* $config = array( 'foo' => array( 'name' => 'bar', 'env' => 'dev', ), ); */
Env
Performs simple environment detection based on host name.
Before running env variable $app['env.host'] must be set.
$app['env']->get(); // return current env name or NULL if not detected $app['env']->getEnvironments(); // returns list of declared environments.
Environments are defined in config file named env:
dev: /\.local\.com$/ prod: //
Bootstrap
Bootstrap is responsible for env detection, Silex providers registration and route registration.
Routes are defined in config file named routing:
<?php return array( 'main' => array( 'pattern' => '/', 'controller' => 'App:Main:index', // resolves to: \App\Controller\Main::index 'method' => 'get', // can be set to: GET, POST, PUT, DELETE, or MATCH. Default is GET ), );
To register some providers in config dir must be created folder named bootstrap with providers config files.
Sample provider config file:
\Silex\Provider\TwigServiceProvider: twig.path: 'view/'
Fatso-skeleton
There's also sample Fatso skeleton, check it out to see how Fatso works.
统计信息
- 总下载量: 21
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2012-11-29