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


docker,php,cli

MacOS's php is not powerful, use docker to execute laravel installer

It's very simple, just add an "alias" alias laravel='docker run --rm -v ${PWD}:/var/www/html -v ~/.dlaravel/cache:/home/dlaravel/.composer /cache -ti deviny/fpm:8.1.10 /home/dlaravel/.composer/vendor/bin/laravel'

php

Use PHP to clear HiBox's inbox via IMAP

The mailbox for receiving letters has exploded, and I don't want all the letters. Use PHP to clear the inbox. The following is the sample program I copied, with minor adjustments.

php,docker,dlaravel

A brief introduction to the phpenv container environment I built

I don't have time to shoot an introduction video, so I'll just grab some pictures and introduce the container environment deviny/phpenv I use. https://github.com/DevinY/phpenvphpenv can be regarded as an evolutionary version of my previous D-Laravel open source project, conceptually extending the use of many Dlaravel operation methods. The update of the container tends to be controlled by the user to build his own image, so I am not very good at changing the version number. In fact, the php version number of D-Laravel seems to have not been changed for a long time:p