by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 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


docker,phpenv

Ran out of Docker IPv4 address pool problem solving

Maybe in the old version of the docker environment, when using Docker compose to start the container, you will encounter the following error: Error response from daemon: could not find an available, non-overlapping IPv4 address pool among the defaults to assign to the network This is actually this It is a symptom of running out of default-address-pools. In some environments, docker-compose will use the private network of Class B by default. The private IP of segment 172 has a range, from 172.16.0.0 to 172.31.255.255. That is to say, when we start a docker-compose Project, it will eat a private section of Class B, which is very heroic.

fastapi,phpenv,docker

How do I create a fastapi runtime environment with phpenv

phpenv php laravel runs HAProxy, and automatically applies for and updates free certification, now let him run Python's fastapi. There is no limit to phpenv, the limit is your idea.😆

php

Randomly generate four yards of English

Randomly generate four yards of English