Home >Backend Development >PHP Tutorial >Laravel 4 Getting Started Video Tutorial

Laravel 4 Getting Started Video Tutorial

黄舟
黄舟Original
2017-08-31 15:33:571302browse

The Laravel framework is an elegant and efficient PHP framework. As it becomes more and more popular, the needs of enterprises are also gradually increasing. It is also capable of meeting the needs of independent development. "Laravel 4 Getting Started Video Tutorial" will take everyone to know the famous Laravel.

Laravel 4 Getting Started Video Tutorial

Course playback address: http://www.php.cn/course/278.html

The teacher’s teaching style:

The lectures are friendly and natural, unpretentious, not pretentious, nor deliberately exaggerated, but talk eloquently and carefully, and the relationship between teachers and students is In an atmosphere of equality, collaboration, and harmony, silent emotional exchanges are carried out, and the desire and exploration of knowledge are integrated into simple and real teaching situations. Students gain knowledge through quiet thinking and silent approval

The more difficult part in this video is the message queue queue and mail queue:

queue configuration

First explain how to use queue in my previous project.

Our current projects all use symfony, older projects use symfony1.4, and newer projects use symfony2. The overall feeling of using symfony is very pleasant, especially symfony2, which generally uses a lot of design ideas from Java frameworks. But it does not support queue. In symfony, we have also gone through several processes using queue. I first used Zhang Yan’s httpsqs. This one is simple to use, but there are single points. After all, our project is still officially for external services, so we studied ActiveMQ, an open source project under Apache, and found that there is a newer MQ under Apache, which is Apollo. In the end we decided to use Apollo.

The main application scenario of queue in our project is to asynchronously process some time-consuming functions, such as synchronizing third-party data, synchronously notifying our third-party data users of data changes, etc. Our general idea is this. If asynchronous processing is needed in each controller, just encode a json object and stuff it into Apollo. Write another work Command, parse the json object in this Command, and call different methods based on the actions and parameters inside. According to business needs, running Command on different machines at the same time as a daemon process can also be considered as a solution to implement asynchronous multi-tasking applications. I kept using it until I discovered laravel. Plan to research it. It's not impossible to replace it if possible. hehe.

Since I just started learning, of course I went straight to laravel5. Routes, controllers, and views are basically the same as symfony, so it’s not difficult to get started. Finally, study the queue.

How to use asynchronous queue

1. Configuration

The definition of the queue will not be introduced here. There are two keys to using asynchronous queues:

(1) Where the queue is stored
(2) The service that performs tasks
Open config/queue.php, this is Laravel5's information about queues configuration file. First, we can specify the default queue driver through the default parameter. The default configuration is sync, which is a synchronous queue. To make an asynchronous queue, we must first change this. Assuming we use database as the driver, the queue tasks will be stored in the database, and we will start another background service to process the queue tasks later. This is the asynchronous method.



The above is the detailed content of Laravel 4 Getting Started Video Tutorial. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn