API Rest with Laravel 5.6 Passport Authentication — Send Notifications with Queues on Redis (Part 5)
https://medium.com/modulr/api-rest-with-laravel-5-6-175eea5db3e8
Last updated
https://medium.com/modulr/api-rest-with-laravel-5-6-175eea5db3e8
Last updated
We learning how to send Notifications with management to queues using Redis. In this tutorial we will use the Notifications created previously in the previous tutorials.https://www.vecteezy.com
— Install Redis — Config Enviroment — Install Redis Driver — Run the Queue Worker — Install andConfigure supervisor
In first step, we install Redis for this I let you two great tutorials for MacOsx and Linux.
Ubuntu 16.04
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-redis-on-ubuntu-16-04
MacOsx
https://medium.com/@petehouston/install-and-config-redis-on-mac-os-x-via-homebrew-eb8df9a4f298
In this step we will config our .env
file, add redis into QUEUE_DRIVER variable also change the REDIS_ variables, finally config the e-mail service. I recomend Mailtrap to test.
We need install Redis driver in to the project, using bellow command, So open your terminal or command prompt and run bellow command:
To test the queues in your local machine need run the queue worker, so run bellow command:
This step is used for production mode in your Linux server.
Install supervisor with the next command:
Enter to folder config.d
Create config file
Into the file write the next code lines
Starting Supervisor
Once the configuration file has been created, you may update the Supervisor configuration and start the processes using the following commands:
Now we are ready to run our example so run bellow command to quick run:
Now, we can simple test by rest client tools (Postman), So I test it and you can see below screenshots.
In this api you have to set two header as listed below:
Thanks for reading! I’m Alfredo Barrón, Feel free to connect with me via Twitter.
Part 1. Passport Authentication Part 2. Confirm account + notifications Part 3. Generate avatar Part 4. Reset Password Part 5. Send Notifications with Queues on Redis — Next up, Localization
You see in the terminal when the notification is processed
Signup
When create new account will receive a email with the link to activate account