PHP's Laravel Framework usage experience

Source: Internet
Author: User

Recently doing a project, is based on the Laravel background API, used to interact with the phone, the data in JSON format. Here's how to get a new frame or language handy within two weeks.

The project uses LARAVEL5.4+DINGOAPI+JWT, and the database uses model (ORM) mode.

1, skilled use of tools, I usually look at the code with sublime, very lightweight tools. Breakpoint debugging with Phpstorm,api test with postman (Google browser plugin), local use of phpstudy to build the environment

2, Sublime will not say, use up relatively simple. Phpstorm configuration debugging, cost a lot of time, in accordance with the method can be configured on the Internet, the use of the problem, the last discovery is to click on the monitoring can be (configured after debugging), is that the upper right corner of the small phone, so simple, and then use postman send data, Phpstorm will stop at the breakpoint, Very convenient.

3, Postman also took a lot of time, mainly download the postman with the online version of the tutorial is inconsistent, looks more awkward, will use, very convenient.

4, Phpstudy build laravel environment, also made some setbacks, the problem is mainly in the PHP version and laravel need to open the dynamic library, the last use of PHP7, dynamic library problems are generally missing DLL files, download the relevant DLL.

5, JWT needs attention, the project uses student, teacher two table certification, but JWT default is the user table certification. The first thing to do is to add the teacher and student logo to the user table, which will also achieve the effect. Finally, the team negotiated or used JWT directly in the student, teacher two table certification. The final JWT needs to be upgraded to version 1.0 to support, because the online tutorials are jwt0.5 versions, so this is going to be upgraded.

Above said is the use of tools, tools with proficiency, to be able to get up.

6, Laravel box, look at the manual, the basic is to configure a variety of files, if you want to understand the laravel principle, you can use Phpstorm debugging code, know how a process.

7, API implementation, online tutorials are older, are not laravel5.4 tutorial, online routing configuration JWT are written in web.php configuration file (old version no api.php, only web.php), after groping 5.4 version JWT should be written in api.php.

8, Dingoapi is very simple, using a few functions, I used two collection paginator, these two functions with transform, quite good, transform use Model Association to get several tables of data.

9, the data table joint query, here is a bit of trouble, originally wanted to use the model of the table associated with this (with), and finally with the implementation, because to be combined with paginator, the final data will be more useless data. Finally go back to using the Leftjoin function implementation.

10, SQL statements, Laravel did the encapsulation, do not know what the last SQL to execute, you can configure SQL listening, SQL to print to the log logs. Configuration is also relatively straightforward.

11, you can set some test data through seed, it is very convenient.

12, just start the database often change, use migrations, each rollback, the data is gone, this is a more headache. It is easy to populate the test data with seed automatically.

It said that all the items used in this project, two weeks from learning to build this backstage.

After this project is finished, ready to do a PHP project training course, through the network distance teaching, can be remote hands-on guidance. Group purchase price of 500 yuan, introduce a can reduce 50 yuan, can go to group 277304970 to register. The content of the training is to develop a complete project using the Laravel framework, which is based on the projects currently being done. Through this increase project experience, to find a job to pave the hope here is a good start.

PHP's Laravel Framework usage experience

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.