by Devin Yang
(This article was automatically translated.)

Published - 5 years ago ( Updated - 5 years ago )

Although I like Laravel very much, Laravel has many features that are very good, such as Eloquent ORM, Model, Blade temple, I like it very much,
But seriously, he's really fat, and it's kind of slow to start, so I'm just trying to do it the way I want
Extract the functions I want, and assemble this self-made frame micro-frame, which is close to Plain PHP. I think anyone who understands PHP can get started.

Let’s look at the response time first. The same code takes 849ms in Laravel, but only 136ms in route free.


In LaNativeRoute, the characteristic is that no route is used, so there is no need to change /route/web.php or /route/api.php.
You don't need to make:controller, you decide whether you want to use the controller or not.

You only need to put the php file you want to execute in the folder of controllers.

  When returning view, it is not necessary to specify the view, the name of the view is not specified, it is the same as the file name in controllers.

Example URL:
http://route_free.test/profile

File System:
controllers/profile.php
views/profile.blade.php

The php in the controllers is the routing, which is natural, but it can be used without adding the extension name in the URL column.
The name of the view is the same as the name of the controller, but the subfile name is blade.php.

The models are all placed in the /modles folder, and the App is also used as the namespace. So you can directly move the model in Laravel to use.

Of course, this assembled car does not have too many rules, so it is like a certification method, you have to build it yourself,
(Laravel can simply php artisan make:auth)
, but relatively speaking, a greater degree of freedom has been improved.

Because there is no routing, the parameters on the URL bar need to be passed to the controller in the traditional way, using question marks.

If you know Laravel and want to play around, welcome to download and have a try.

I believe you will understand once you touch it.

https://github.com/DevinY/LaNativeRoute

I still have a lot of ideas that I want to implement in this framework :).

Tags: php

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


php

Randomly generate four yards of English

Randomly generate four yards of English

docker,phpenv

Unable to ping host.docker.internal on Linux

You can check with docker version, confirm that the version is Docker v20.10+, you can add extra_hosts as follows:

php, CentOS, phpize

Can't find phpize on older versions of CentOS, can't compile php extensions.

Can't find phpize on older versions of CentOS, can't compile php extensions. How to install phpize?