damel / flight-skeleton
Flight PHP 微框架应用的骨架。
dev-master
2015-03-27 13:39 UTC
Requires
- php: >=5.3.3
- mikecao/flight: ~1.2
Suggests
- forestry/log: Small log file writer with adjustable log level settings.
- forestry/orm: Small ORM for simple CRUD operations
- maximebf/consolekit: PHP 5.3 library to create command line utilities
This package is auto-updated.
Last update: 2024-08-29 03:23:44 UTC
README
此骨架为使用 Flight PHP 微框架开发应用提供快速启动。
它还包含基于 HTML5 Boilerplate 的一些模板。
下载骨架
首先,请确保您已安装并配置了带有 PHP 5.3.3 或更高版本的 Web 服务器(如 Apache)。然后使用 composer 创建您的项目
$ composer create-project damel/flight-skeleton path/to/install
您将看到以下结构
path/to/install
├── app
│ ├── config
│ │ ├── config.php
│ │ └── routes.php
│ ├── logs
│ └── resources
│ └── templates
│ ├── 404.php
│ ├── index.php
│ └── layout.php
├── cli
├── public
│ ├── css
│ │ ├── main.css
│ │ └── normalize.css
│ ├── img
│ ├── js
│ │ ├── modernizr-2.6.2.min.js
│ │ └── plugins.js
│ ├── .htaccess
│ ├── apple-touch-icon*.png
│ ├── crossdomain.xml
│ ├── favicon.ico
│ ├── humans.txt
│ ├── index.php
│ └── robots.txt
├── src
│ └── Acme
│ └── Demo
│ └── Controller
│ └── Demo.php
├── vendor
│ ├── composer
│ ├── mikecao
│ └── autoload.php
├── composer.json
├── composer.lock
├── LICENSE
└── README.md
创建应用
如果您想定义全局常量或其他设置,您可以使用 app/config/config.php
。
路由
要定义您的路由,请使用 app/config/routes
文件。
<?php //Routes of the application. \Flight::route('/', array('\Acme\Demo\Controller\Demo', 'index'));
控制器
将您的代码放在 src
文件夹中。这里的所有类都由其命名空间自动加载。例如,查看 src/Acme/demo/Controller/Demo.php
中的示例代码。如您所见,控制器使用命名空间 Acme\Demo\Controller
。
模板
默认情况下,模板从 app/resources/templates/
加载。您可以通过编辑 app/config/config.php
中的路径来更改此设置。
许可证
此骨架在 MIT 许可证下发布。