https://github.com/jpcaparas/laravel-horizon-demo
A demo for Laravel Horizon, a Redis queue monitor. Announced at Laracon US 2017.
https://github.com/jpcaparas/laravel-horizon-demo
async-programming horizon jobs laravel queues redis
Last synced: 15 days ago
JSON representation
A demo for Laravel Horizon, a Redis queue monitor. Announced at Laracon US 2017.
- Host: GitHub
- URL: https://github.com/jpcaparas/laravel-horizon-demo
- Owner: jpcaparas
- Created: 2017-08-08T20:04:38.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-08-21T20:36:25.000Z (over 7 years ago)
- Last Synced: 2025-03-26T15:04:20.592Z (about 1 month ago)
- Topics: async-programming, horizon, jobs, laravel, queues, redis
- Language: PHP
- Homepage: https://horizon.laravel.com
- Size: 1.55 MB
- Stars: 16
- Watchers: 2
- Forks: 6
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Laravel Horizon Demo

Laravel Horizon provides an easy-to-use, interactive GUI to monitor and interact with Redis queues.
Horizon was announced at Laracon US 2017 in NYC. It requires Laravel 5.5 to run (which is currently in beta).
## Quick start
1. Clone this project.
1. Run `php composer install`.
1. Sign up for a [free Mailtrap account](https://mailtrap.io/) and copy API credentials. We'll use Mailtrap to **spoof outgoing emails** using their demo inbox:

1. Enter values for these directives on your `.env` file:
- `APP_KEY` → Run `php artisan key:generate` to easily generate a base64-encoded key.
- `MAIL_*` → Enter Mailtrap credentials.
- `REDIS_*` → A standard Redis installation usually does not require you to change values.
1. Run `php artisan config:cache` to use the values set above.1. Create a blank `database.sqlite` under your `./database` directory.
1. Run `php artisan migrate --seed` to create a user table and seed it with dummy user information (e.g. name, email).
1. Run `composer dump-autoload` to clear the PHP class cache.
1. Open a new shell prompt and run `php artisan serve` to serve the web application on the foreground using PHP's built in web server.
Note: On macOS, it's easier to use [Laravel Valet](https://laravel.com/docs/5.4/valet).
1. Open a new shell prompt and run `php artisan horizon` on the foreground and view the Horizon dashboard at `http://[app-host]/horizon`.

1. By visiting `http://[app-host]/queues/fetch-star-wars-entity?repeat=1&user_id=1`, you can now test Horizon by creating a job that fetches a random Star Wars entity from the [unofficial Star Wars public API](http://swapi.co/) and subsequently sends a notification email.

Two async jobs are actually dispatched when you hit the URL above: (a) one that fetches from the Star Wars API and (b) another one that sends a notification email.

Note: You can increase the number of requests sent (and conversely, resulting email notifications) by increasing the `repeat` query parameter to a higher number -- say, for example, _100_. Just be aware that if using a service _other than Mailtrap's demo inbox_, you might get **flagged for sending spam**.## Requirements
- PHP v7.1
- Redis v3.x## Attributions
This wouldn't be possible without being granted a role as Software Developer at Pixel Fusion, an award-winning product development company at Parnell, Auckland.