{"id":18671651,"url":"https://github.com/vdlp/oc-horizon-plugin","last_synced_at":"2025-04-12T01:30:47.738Z","repository":{"id":62543879,"uuid":"379268769","full_name":"vdlp/oc-horizon-plugin","owner":"vdlp","description":"Laravel Horizon integration for October CMS.","archived":false,"fork":false,"pushed_at":"2024-11-22T13:25:12.000Z","size":82,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-25T05:31:18.639Z","etag":null,"topics":["cms","laravel","octobercms-plugin","php","queue","redis"],"latest_commit_sha":null,"homepage":"https://octobercms.com/plugin/vdlp-horizon","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vdlp.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-22T12:52:58.000Z","updated_at":"2024-11-22T13:25:15.000Z","dependencies_parsed_at":"2024-03-14T14:50:57.079Z","dependency_job_id":"2adddb8a-ec16-4332-b0d6-0e7f86f6f34c","html_url":"https://github.com/vdlp/oc-horizon-plugin","commit_stats":{"total_commits":40,"total_committers":3,"mean_commits":"13.333333333333334","dds":"0.17500000000000004","last_synced_commit":"7e597f6c4e556f2a2fb9deb7cdd1f9aa5d7c023e"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdlp%2Foc-horizon-plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdlp%2Foc-horizon-plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdlp%2Foc-horizon-plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vdlp%2Foc-horizon-plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vdlp","download_url":"https://codeload.github.com/vdlp/oc-horizon-plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248504198,"owners_count":21115133,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cms","laravel","octobercms-plugin","php","queue","redis"],"created_at":"2024-11-07T09:06:37.431Z","updated_at":"2025-04-12T01:30:47.483Z","avatar_url":"https://github.com/vdlp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Vdlp.Horizon\n\nProvides a seamless integration of [Laravel Horizon 5.0](https://laravel.com/docs/9.x/horizon) inside October CMS.\n\n![Laravel Horizon Logo](https://plugins.vdlp.nl/octobercms/oc-horizon-plugin/logo.png)\n\nQueues, With X-Ray Vision. Supercharge your queues with a beautiful dashboard and code-driven configuration.\n\n![Laravel Horizon Dashboard](https://plugins.vdlp.nl/octobercms/oc-horizon-plugin/dashboard.png)\n\n### A match made in heaven\n\nHorizon is developed by the core developers of the Laravel framework and provides a robust queue monitoring solution for Laravel's Redis queue. Horizon allows you to easily monitor key metrics of your queue system such as job throughput, runtime, and job failures.\n\n### Open Source\n\nHorizon is 100% open source, so you're free to dig through the source to see exactly how it works. See something that needs to be improved? Just send us a pull request on GitHub.\n\n## Requirements\n\n* October CMS 3.0\n* PHP 8.0.2 or higher\n* PHP extensions: `ext-pcntl`, `ext-posix` and `ext-redis`.\n* Supervisor, see [Laravel 9.x supervisor configuration](https://laravel.com/docs/9.x/queues#supervisor-configuration).\n\n## Installation\n\n```\ncomposer require vdlp/oc-horizon-plugin\n```\n\n### Turn off auto discovery for `laravel/horizon` (important)\n\nBecause this plugin has it's own `HorizonServiceProvider` which extends from the `Laravel\\Horizon\\HorizonServiceProvider`\nwe need to prevent the `Laravel\\Horizon\\HorizonServiceProvider` from being loaded due to Laravels' auto package discovery.\n\nYou should add the `dont-discover` option to your projects `composer.json` file (which is located in the root path of your project).\n\n```\n\"extra\": {\n    \"laravel\": {\n        \"dont-discover\": [\n            \"laravel/horizon\"\n        ]\n    }\n}\n```\n\n\u003e IMPORTANT: After adding these lines, make sure you execute `composer update` to apply the changes. You also need to remove the file `storage/framework/packages.php` file. No worries. This file will be re-generated once you access your project.\n\n\u003e IMPORTANT: Make sure the `composer.json` is deployed to your hosting site. This will be parsed by te framework to determine which service providers should be ignored.\n\n## Configuration\n\n```\nphp artisan horizon:install\n```\n\n* Configure Laravel Horizon settings file at `config/horizon.php`, please make sure `use` contains `horizon` (see the configuration snippet below).\n\n```\n    /*\n    |--------------------------------------------------------------------------\n    | Horizon Redis Connection\n    |--------------------------------------------------------------------------\n    |\n    | This is the name of the Redis connection where Horizon will store the\n    | meta information required for it to function. It includes the list\n    | of supervisors, failed jobs, job metrics, and other information.\n    |\n    */\n\n    'use' =\u003e 'horizon',\n```\n\n* Add connection to `config/queue.php`:\n\n```\n    'redis' =\u003e [\n\n        'driver' =\u003e 'redis',\n        'connection' =\u003e 'horizon', // References: databases.redis.horizon\n        'queue' =\u003e env('REDIS_QUEUE', 'default'),\n        'retry_after' =\u003e env('QUEUE_RETRY_AFTER', 90),\n        'block_for' =\u003e null,\n\n    ],\n```\n\n* Add Redis database configuration for Horizon specifically to `config/databases.php`:\n\n```\n    'redis' =\u003e [\n\n        'cluster' =\u003e false,\n        'client' =\u003e 'phpredis',\n\n        'default' =\u003e [\n            // ..\n        ],\n\n        'horizon' =\u003e [\n            'host' =\u003e env('HORIZON_REDIS_HOST', '127.0.0.1'),\n            'password' =\u003e env('HORIZON_REDIS_PASSWORD'),\n            'port' =\u003e env('HORIZON_REDIS_PORT', 6379),\n            'database' =\u003e env('HORIZON_REDIS_DATABASE', '1'),\n        ]\n\n    ],\n```\n\n* Modify the queue connection `QUEUE_CONNECTION` (which can be found in `config/queue.php`) to `redis` as such:\n\n```\n    /*\n    |--------------------------------------------------------------------------\n    | Default Queue Driver\n    |--------------------------------------------------------------------------\n    |\n    | The Laravel queue API supports a variety of back-ends via an unified\n    | API, giving you convenient access to each back-end using the same\n    | syntax for each one. Here you may set the default queue driver.\n    |\n    | Supported: \"null\", \"sync\", \"database\", \"beanstalkd\",\n    |            \"sqs\", \"iron\", \"redis\"\n    |\n    */\n\n    'default' =\u003e env('QUEUE_CONNECTION', 'redis'),\n```\n\n* `.env` should at least have the following `QUEUE_` and `HORIZON_` variables:\n\n```\n#\n# Queue\n#\nQUEUE_CONNECTION = \"redis\"\nQUEUE_RETRY_AFTER = 90\n\n#\n# Horizon\n#\nHORIZON_PREFIX = \"myproject-local:\"\n\nHORIZON_REDIS_HOST = \"127.0.0.1\"\nHORIZON_REDIS_PASSWORD = null\nHORIZON_REDIS_PORT = 6379\nHORIZON_REDIS_DATABASE = \"1\"\n\n```\n\nIt's recommended to add your Queue Worker Configuration `config.horizon.environments` to the `.env` file as well.\n\n## Server configuration\n\n* Add the following to the `supervisord` configuration on the server. The complete `supervisord` configuration can be found [on the supervisor website](http://supervisord.org/index.html).\n* See [Configuring Supervisor](https://laravel.com/docs/9.x/queues#configuring-supervisor) (Official Laravel Documentation).\n```\n[program:\u003cqueue-name\u003e-queue]\nprocess_name=%(program_name)s_%(process_num)02d\ndirectory=/\u003cmyproject-directory\u003e\ncommand=/\u003cpath-to-php\u003e/php /\u003cmyproject-directory\u003e/artisan horizon\nautostart=true\nautorestart=true\nstopasgroup=true\nkillasgroup=true\nuser=\u003cuser\u003e\nnumprocs=1\nredirect_stderr=true\nstdout_logfile=/var/log/supervisord/\u003cqueue-name\u003e-queue.log\nstopwaitsecs=90\n```\n\n* Add the following to the cronjob configuration on the server. This will make sure the [Horizon metrics](https://laravel.com/docs/9.x/horizon#metrics) are created periodically.\n\n```\n* * * * * /\u003cpath-to-php\u003e/php /\u003cmyproject-directory\u003e/artisan schedule:run \u003e /dev/null\n```\n\n## Creating Job classes\n\nFollow the instructions at [Laravel 9.x generating job classes](https://laravel.com/docs/9.x/queues#generating-job-classes) on how to make Job classes.\n\n\u003e Please note that the use of the `php artisan make:job` command is not supported in October CMS. October CMS is using a different application structure in comparison to a generic Laravel project.\n\nThis plugin also contains an example job file: `Vdlp\\Horizon\\Example`.\nThis example file does not use the `SerializesModels` and `InteractsWithQueue` trait.\n\n## Testing\n\n1. Log-in to the backend.\n2. Put application in debug mode using the `.env` file: `APP_DEBUG=true` or by changing the `debug` key in the `config/app.php` file.\n3. Run Horizon using this command: `php artisan horizon`.\n4. Now run this command to push some `Vdlp\\Horizon\\Example` jobs to the queue:\n\n```\nphp artisan vdlp:horizon:push-example-jobs\n```\n\n5. Check the Horizon dashboard at `/backend/vdlp/horizon/dashboard` or at `/horizon`.\n6. Each `Vdlp\\Horizon\\Example` job should log a random string to the application log (level = `debug`).\n\n## Documentation\n\nPlease go to the Laravel website for detailed documentation about Laravel Horizon.\n\n[Horizon for Laravel 9.x](https://laravel.com/docs/9.x/horizon)\n\n## Questions\n\nIf you have any question about how to use this plugin, please don't hesitate to contact us at [octobercms@vdlp.nl](mailto:octobercms@vdlp.nl). We're\nhappy to help you. You can also visit the support forum and drop your questions/issues there.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdlp%2Foc-horizon-plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvdlp%2Foc-horizon-plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvdlp%2Foc-horizon-plugin/lists"}