GithubHelp home page GithubHelp logo

jpcaparas / laravel-horizon-demo Goto Github PK

View Code? Open in Web Editor NEW
15.0 3.0 4.0 1.59 MB

A demo for Laravel Horizon, a Redis queue monitor. Announced at Laracon US 2017.

Home Page: https://horizon.laravel.com

PHP 95.45% ApacheConf 0.68% Vue 0.66% HTML 3.21%
horizon laravel redis queues jobs async-programming

laravel-horizon-demo's Introduction

Laravel Horizon Demo

laravel-horizon

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.

  2. Run php composer install.

  3. Sign up for a free Mailtrap account and copy API credentials. We'll use Mailtrap to spoof outgoing emails using their demo inbox:

    Mailtrap demo inbox

  4. 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.

  2. Create a blank database.sqlite under your ./database directory.

  3. Run php artisan migrate --seed to create a user table and seed it with dummy user information (e.g. name, email).

  4. Run composer dump-autoload to clear the PHP class cache.

  5. 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.

  6. Open a new shell prompt and run php artisan horizon on the foreground and view the Horizon dashboard at http://[app-host]/horizon.

    horizon-cli

  7. 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 and subsequently sends a notification email.

    fetch-star-wars-entity-url

    fetch-star-wars-entity-result

    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.

    two-jobs

    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.

laravel-horizon-demo's People

Contributors

ismaail avatar jpcaparas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

laravel-horizon-demo's Issues

Job fail in FetchedStarWarsEntity

Thanks for the demo,

The Job FetchedStarWarsEntity fails

ErrorException: Undefined index: name in /home/.../laravel-horizon-demo/app/Notifications/FetchedStarWarsEntity.php:56

Changing the attribute $entity from private to public did not fix the issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.