steevedroz/nano-framework
最新稳定版本:1.5.2
Composer 安装命令:
composer require steevedroz/nano-framework
包简介
README 文档
README
DISCLAIMER: This is not a good Framework, its sole purpose is the teaching of the mechanisms behind a Framework. For example, the database is simply a bunch of JSON files that have to be completely rewritten each time a single value is edited. Please consider choosing a real framework if you intend to use this as a base for your website.
NanoFramework is an extremely tiny PHP Framework. Its source code holds in 6 classes and 1 dependency. The goal is to stay clear while learning by allowing the student to not be lost in hundreds of source files.
Installation
In order to install NanoFramework:
- Create an empty folder on your computer, where your local server asks you to (usually a directory named
wwworhtdocs). - From that folder, run the command
composer require steevedroz/nano-framework(you may need to install composer beforehand). - Run the command
vendor/bin/nano-generate, accept the override ofcomposer.json. - Run the command
composer dumpautoloadto reload all the generated files. - Run the website and behold the first page!
Usage
This will explain the basic usage of the Framework. For a more in depth explanation, please consider visiting the doc.
MVC
NanoFramework uses the Model-View-Controller architecture.
The flow is the following:
- The server recieves a request to a URI.
index.phpis called, the route is analyzed.- If the route is referenced in the file called
routes, it is changed to its corresponding value. - The route (maybe modified) represents the name of a Controller, the name of a method and parameters (parameters are optional, the method is
indexif not specified, only the Controller name is required). - The corresponding method of the Controller is called.
- That method may call a Model, in order to obtain data from the database.
- That method may call a View, possibly passing it the data, in order to generate an HTML file.
- The method returns that file that is bubbled up to
index.phpand displayed on screen.
统计信息
- 总下载量: 872
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-17