taviroquai / duality-demo
该包的最新版本(v1.0.0)没有提供许可证信息。
Duality PHP 框架项目
v1.0.0
2014-12-07 21:11 UTC
Requires
- taviroquai/duality: v1.0.0
This package is auto-updated.
Last update: 2024-09-08 06:52:30 UTC
README
安装
- 下载 zip 文件并将其 解压 到 Apache 网络目录中
- 使用 composer 安装依赖项:php composer.phar install
- 在 Apache 服务器上启用 mod rewrite
- 编辑 config/app.php 并更改您的本地设置
- 在浏览器中打开 https:///duality-demo/
最小 API 使用示例
// Include local configuration $config = array( 'server' => array( 'url' => '/duality-demo', 'hostname' => 'localhost' ) ); // Load dependencies require_once './vendor/autoload.php'; // Create a new application container $app = new \Duality\App(dirname(__FILE__), $config); // Get server and request $server = $app->call('server'); $request = $server->getRequestFromGlobals($_SERVER, $_REQUEST); // Validate HTTP request if (!$request) die('HTTP request not found!'); // Set request $server->setRequest($request); // Define default route $app->call('server')->setHome(function(&$req, &$res) { // Tell response what is the output $res->setContent('Hello World!'); }); // Finaly, tell server to start listening $app->call('server')->listen();