Home > Backend Development > PHP Tutorial > Minor [PHP Framework] 1. Introduction, introduction to minorphp framework_PHP tutorial

Minor [PHP Framework] 1. Introduction, introduction to minorphp framework_PHP tutorial

WBOY
Release: 2016-07-12 08:50:25
Original
979 people have browsed it

Minor [PHP Framework] 1. Introduction, introduction to minorphp framework

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>

from the link. If your server is using Apache, make sure to enable the

module.

location /<span> {
    try_files $uri $uri</span>/ /index.php?<span>$query_string;
}</span>
Copy after login
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>
Copy after login

1.5 Please ignore the above bragging field

Yeah! Just please ignore it. Don’t blame me for not reminding you

 

http://www.bkjia.com/PHPjc/1133571.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1133571.htmlTechArticle
Minor [PHP Framework] 1. Introduction, introduction to minorphp framework 1.1 What is Minor Minor is a simple but excellent PHP Framework, It just did what a framework should do. Just do what a framework should do.
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template