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


phpenv

phpenv database environment

This article describes how to pull out the database service of phpenv to an independent environment. PHPENV can define database services in SERVICE through environment variables. If necessary in the development environment, we can easily restart all services, nginx, fpm and db through commands such as ./start and ./restart. But if it is in online mode, I don't want to restart the website, even the entire DB is restarted. For example, when the php version is updated, the DB does not need to be restarted.

openspeedtest,docker,phpenv

Run OpenSpeedTest with phpenv

Although we may use websites such as speedtest to test the speed of uploading and uploading, what if we want to test the speed of our own Server? For example, if the user is in another country, the speed of connecting to our host is slow, then the self-hosted test tool is very convenient. The latest version of phpenv has added openspeedtest.yml to the yml file of services.

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.