1.1 What is Minor
Minor is a simple but excellent PHP framework. It just did what a framework should do. It just does what a framework should do. It is simple but powerful!
Framework Github address: github.com/Orlion/Minor
(If you think it’s good, give it a star (^-^)V)
Author: Orlion
Zhihu: https://www.zhihu.com/people/orlion
Github: https://github.com/Orlion
What’s in 1.2 Minor
1.2.1 Minor mainly provides:
1.2.2 Why does Minor only provide so few things?
Most of the current PHP frameworks are very bloated and provide various functions. In my opinion, this is just reinventing the wheel (although writing frameworks is also reinventing the wheel...). The framework only needs to provide users with a shelf and Just a few tools are enough. Users should not be given a lot of things (a lot of repetitively reinvented wheels). Users should not be tied up but given great freedom. This will also make it easier for users to get started. Personally, I think Java's Spring framework is a very good framework. It's simple enough, powerful enough, and small is beautiful! Minor is a framework born under this idea. Without all kinds of messy paging, ORM, template engine, log, queue and other functions, it is just a pure "shelf".
1.2.3 Advantages
Hurry! High performance! Simple! Easy to get started! Clear structure!
Small is beautiful!
1.3 Installation
Just git clone from github (github.com/Orlion/Minor) or directly copy the zip package and unzip it into the project.
The Minor framework sets <span class="token keyword">public<span class="token operator">/<span class="token punctuation">.htaccess<code class=" language-php"><span class="token keyword">public<span class="token operator">/<span class="token punctuation">.htaccess</span></span></span>
index<span class="token punctuation">.php</span>
mod_rewrite
file removes index<span class="token punctuation">.php</span>
module.
location /<span> { try_files $uri $uri</span>/ /index.php?<span>$query_string; }</span>If it is an Nginx server, put the following instructions in the configuration file of the URL:
In this way, when you visit http://localhost/public/, you can see the successful installation screen. (Of course you can also configure it to remove public)
How the 1.4 Minor works
1.4.1 Overall process
Take the URL http://www.servername.com/demo/test as an example:
1.4.2 How App handles requests
<span> public</span> <span>function</span> handle(MinorRequest <span>$minorRequest</span><span>) { </span><span>$minorResponse</span> = MinorResponse::<span>getInstance(); </span><span>$this</span>->minorRequest = <span>$minorRequest</span><span>; </span><span>list</span>(<span>$controllerName</span>, <span>$actionName</span>, <span>$params</span>) = <span>$this</span>->router->dispatcher(<span>$minorRequest</span>-><span>getUrl()); </span><span>if</span> (!(<span>$controllerName</span> && <span>$actionName</span> && <span>is_array</span>(<span>$params</span><span>))) { </span><span>if</span> (!Config::get(['app' => 'DEBUG']) && (<span>$handler</span> = Config::get(['app' => '404_HANDLER'])) && (<span>$handler</span><span> instanceof \Closure)) { </span><span>$handler</span>(<span>$minorRequest</span>-><span>getRequestUrl()); } </span><span>else</span><span> { </span><span>throw</span> <span>new</span> RouteException('404 Not Found'<span>); } } </span><span>else</span><span> { </span><span>$minorResponse</span> = <span>$this</span>->invoke(<span>$controllerName</span>, <span>$actionName</span>, <span>$params</span><span>); } </span><span>return</span> <span>$minorResponse</span><span>; }</span>
1.5 Please ignore the above bragging field
Yeah! Just please ignore it. Don’t blame me for not reminding you