99designs / ergo
此包已被弃用且不再维护。未建议替代包。
PHP 5.3 的路由和请求/响应处理微框架
v2.7.0
2014-07-08 23:44 UTC
Requires
- php: >=5.3.0
- psr/log: 1.0.*
Requires (Dev)
- mockery/mockery: dev-master
- phpunit/phpunit: 3.7.*
- dev-master
- v2.7.0
- v2.6.2
- v2.6.1
- v2.6.0
- v2.5.1
- v2.5.0
- v2.4.6
- v2.4.5
- v2.4.4
- v2.4.3
- v2.4.2
- v2.4.1
- v2.4.0
- 2.3.0
- v2.2.1
- v2.2.0
- v2.1.1
- v2.1.0
- v2.0.0
- dev-lazy-load-the-error-handler
- dev-composer_lock
- dev-template-uniqueness
- dev-nginx
- dev-trash/build
- dev-features/cibuild_script
- dev-bugs/web-error-handler-ob-fix
- dev-request-factory-http-host
This package is not auto-updated.
Last update: 2020-01-24 14:45:58 UTC
README
一个轻量级的库,用于处理PHP5.3中的请求和响应。提供基于闭包的路由、控制器和模板化基础设施。
名字来源于拉丁语,Cogito ergo sum。“我思故我在”。
安装
Ergo 被设计得易于安装和集成。
$ pear channel-discover pearhub.org
$ pear install pearhub/Ergo
或者,将其作为子模块检出,并在类目录上使用自己的类加载器。
基本用法
require_once('Ergo/ergo.php');
Ergo::router()->connect('/helloworld', 'helloworld', function() {
return Ergo::template('helloworld.tpl.php', array(
'greeting'=>'Hello World'
));
});
Ergo::router()->connect('/*', 'any', function() {
throw new \Ergo\Http\NotFound("Not implemented yet");
});
如何开发
对于运行,Ergo 没有外部依赖。对于开发,使用 Composer 来拉取 SimpleTest 作为依赖。
通过 Composer 安装依赖
$ composer install --dev
运行测试套件
$ phpunit
PHPUnit 3.7.10 by Sebastian Bergmann.
Configuration read from /home/vagrant/ergo/phpunit.xml.dist
............................................................... 63 / 100 ( 63%)
.....................................
Time: 0 seconds, Memory: 11.25Mb
OK (100 tests, 269 assertions)
状态
被用于包括 99designs.com、flippa.com、learnable.com 和 sitepoint.com 在内的多个高流量生产网站。