diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 0000000..a839255
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,11 @@
+# To get started with Dependabot version updates, you'll need to specify which
+# package ecosystems to update and where the package manifests are located.
+# Please see the documentation for all configuration options:
+# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
+
+version: 2
+updates:
+ - package-ecosystem: "composer"
+ directory: "/"
+ schedule:
+ interval: "daily"
diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
new file mode 100644
index 0000000..c6894db
--- /dev/null
+++ b/.github/workflows/php.yml
@@ -0,0 +1,54 @@
+name: PHP Composer
+
+on:
+ push:
+ branches: [ develop ]
+ pull_request:
+ branches: [ develop ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ strategy:
+ fail-fast: true
+ matrix:
+ php: [ 8.0, 8.1 ]
+ stability: [ prefer-lowest, prefer-stable ]
+
+ name: PHP ${{ matrix.php }} - ${{ matrix.stability }}
+
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Setup PHP
+ uses: shivammathur/setup-php@v2
+ with:
+ php-version: ${{ matrix.php }}
+ coverage: none
+
+ - name: Add HTTP basic auth credentials
+ run: echo '${{ secrets.VDLP_OCTOBER_CMS_AUTH_JSON }}' > $GITHUB_WORKSPACE/auth.json
+
+ - name: Validate composer.json and composer.lock
+ run: composer validate
+
+ - name: Cache Composer packages
+ id: composer-cache
+ uses: actions/cache@v2
+ with:
+ path: vendor
+ key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-php-
+
+ - name: Install dependencies
+ if: steps.composer-cache.outputs.cache-hit != 'true'
+ run: composer install --prefer-dist --no-progress --no-suggest
+
+ # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
+ # Docs: https://getcomposer.org/doc/articles/scripts.md
+
+ # - name: Run test suite
+ # run: composer run-script test
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7d80e29..410dc3c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
+## [3.0.0] - 2022-04-16
+
+- Upgrade to Horizon 5.0 (requires October CMS 3.0)
+- Checkout the README.md file for installation and configuration instructions.
+
+### Added
+- Add GitHub WorkFlow configuration.
+
+### Changed
+- Changed minimum PHP requirement to PHP 8.0.2
+- Changed minimum October CMS version requirement to 3.0
+- Use `horizon:install` instead of `horizon:assets` to publish the required assets for the Horizon Dashboard.
+- Compare changes in the `config/horizon.php` file with `vendor/laravel/horizon/config/horizon.php`.
+
## [2.0.2] - 2022-03-08
### Changed
diff --git a/Plugin.php b/Plugin.php
index 7fade00..8c1c982 100644
--- a/Plugin.php
+++ b/Plugin.php
@@ -7,7 +7,6 @@
use Backend\Classes\AuthManager;
use Backend\Helpers\Backend;
use Backend\Models\User;
-use Illuminate\Foundation\AliasLoader;
use Illuminate\Notifications\NotificationServiceProvider;
use Laravel\Horizon\Horizon;
use System\Classes\PluginBase;
@@ -68,8 +67,6 @@ public function register(): void
{
$this->app->register(HorizonServiceProvider::class);
$this->app->register(NotificationServiceProvider::class);
-
- AliasLoader::getInstance()->alias('Horizon', 'Laravel\Horizon\Horizon');
}
public function registerSchedule($schedule): void
@@ -110,20 +107,20 @@ public function registerMailTemplates(): array
private function bootNotificationSettings(): void
{
- if ((bool) config('vdlp.horizon::mail_notifications_enabled', false)) {
+ if (config('vdlp.horizon::mail_notifications_enabled', false) === true) {
Horizon::routeMailNotificationsTo(
config('vdlp.horizon::mail_notifications_to')
);
}
- if ((bool) config('vdlp.horizon::slack_notifications_enabled', false)) {
+ if (config('vdlp.horizon::slack_notifications_enabled', false) === true) {
Horizon::routeSlackNotificationsTo(
config('vdlp.horizon::slack_notifications_webhook_url'),
config('vdlp.horizon::slack_notifications_channel')
);
}
- if ((bool) config('vdlp.horizon::sms_notifications_enabled', false)) {
+ if (config('vdlp.horizon::sms_notifications_enabled', false) === true) {
Horizon::routeSmsNotificationsTo(
config('vdlp.horizon::sms_notifications_to')
);
diff --git a/README.md b/README.md
index 0e2e2f3..87307bb 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
# Vdlp.Horizon
-Provides a seamless integration of [Laravel Horizon 3.0](https://laravel.com/docs/6.x/horizon) inside October CMS.
+Provides a seamless integration of [Laravel Horizon 5.0](https://laravel.com/docs/9.x/horizon) inside October CMS.
![Laravel Horizon Logo](https://plugins.vdlp.nl/octobercms/oc-horizon-plugin/logo.png)
@@ -18,10 +18,10 @@ Horizon is 100% open source, so you're free to dig through the source to see exa
## Requirements
-* October CMS 1.0 or higher
-* PHP 7.4 or PHP 8.0+
+* October CMS 3.0
+* PHP 8.0.2 or higher
* PHP extensions: `ext-pcntl`, `ext-posix` and `ext-redis`.
-* Supervisor, see [Laravel 6.x supervisor configuration](https://laravel.com/docs/6.x/queues#supervisor-configuration).
+* Supervisor, see [Laravel 9.x supervisor configuration](https://laravel.com/docs/9.x/queues#supervisor-configuration).
## Installation
@@ -38,9 +38,6 @@ You should add the `dont-discover` option to your projects `composer.json` file
```
"extra": {
- "merge-plugin": {
- ...
- },
"laravel": {
"dont-discover": [
"laravel/horizon"
@@ -64,10 +61,10 @@ php artisan horizon:install
To update the Horizon Assets you can use the following command:
```
-php artisan horizon:assets
+php artisan horizon:publish
```
-> IMPORTANT: Add the above command to your deployment logic. This way the assets will always be up to date on your staging or production environment.
+> IMPORTANT: Add the above command to your deployment logic or composer update scripts. This way the assets will always be up to date on your staging or production environment.
* Configure Laravel Horizon settings file at `config/horizon.php`, please make sure `use` contains `horizon` (see the configuration snippet below).
@@ -226,7 +223,7 @@ php artisan vdlp:horizon:push-example-jobs
Please go to the Laravel website for detailed documentation about Laravel Horizon.
-[Horizon for Laravel 6.x](https://laravel.com/docs/6.x/horizon)
+[Horizon for Laravel 9.x](https://laravel.com/docs/9.x/horizon)
## Questions
diff --git a/composer.json b/composer.json
index bfd940a..5131e3d 100644
--- a/composer.json
+++ b/composer.json
@@ -20,13 +20,13 @@
"email": "octobercms@vdlp.nl"
},
"require": {
- "php": "^7.4 || ^8.0",
+ "php": "^8.0.2",
"ext-pcntl": "*",
"ext-posix": "*",
"ext-redis": "*",
"composer/installers": "^1.0 || ^2.0",
- "laravel/horizon": "^3.0",
- "october/system": "^1.0 || ^2.0"
+ "laravel/horizon": "^5.0",
+ "october/system": "^3.0"
},
"archive": {
"exclude": [
diff --git a/http/controllers/HomeController.php b/http/controllers/HomeController.php
new file mode 100644
index 0000000..4cdd6e4
--- /dev/null
+++ b/http/controllers/HomeController.php
@@ -0,0 +1,28 @@
+ $pathHelper->assetsAreCurrent(),
+ 'cssFile' => Horizon::$useDarkTheme ? 'app-dark.css' : 'app.css',
+ 'horizonScriptVariables' => Horizon::scriptVariables(),
+ 'isDownForMaintenance' => App::isDownForMaintenance(),
+ ]);
+ }
+}
diff --git a/routes.php b/routes.php
deleted file mode 100644
index b636b3a..0000000
--- a/routes.php
+++ /dev/null
@@ -1,43 +0,0 @@
-group(['middleware' => ['web']], static function () use ($router, $pathHelper): void {
- $router->get('/vendor/horizon/img/horizon.svg', static function () use ($pathHelper): BinaryFileResponse {
- /** @var ResponseFactory $factory */
- $factory = resolve(ResponseFactory::class);
-
- return $factory->download($pathHelper->getAssetsPath('img/horizon.svg'), 'horizon.svg', [
- 'Content-Type' => 'image/svg+xml',
- ]);
- });
-});
-
-if (!$pathHelper->assetsAreCurrent()) {
- $router->group([
- 'domain' => config('horizon.domain'),
- 'prefix' => config('horizon.path'),
- 'middleware' => config('horizon.middleware', 'web'),
- ], static function () use ($router): void {
- $router->get('/{anything?}', static function (Request $request): string {
- if (Laravel\Horizon\Horizon::check($request)) {
- return 'The published Horizon assets are not up-to-date with the installed version. '
- . 'To update, run:php artisan horizon:assets
';
- }
-
- abort(403);
- })->where('anything', '(.*)');
- });
-}
diff --git a/serviceproviders/HorizonServiceProvider.php b/serviceproviders/HorizonServiceProvider.php
index a880ab6..e81a8f9 100644
--- a/serviceproviders/HorizonServiceProvider.php
+++ b/serviceproviders/HorizonServiceProvider.php
@@ -4,6 +4,7 @@
namespace Vdlp\Horizon\ServiceProviders;
+use Illuminate\Support\Facades\Route;
use Laravel\Horizon;
use Laravel\Horizon\HorizonServiceProvider as HorizonServiceProviderBase;
use Vdlp\Horizon\Listeners\SendNotification;
@@ -30,4 +31,20 @@ protected function registerResources(): void
{
$this->loadViewsFrom(plugins_path('vdlp/horizon/views'), 'horizon');
}
+
+ protected function registerRoutes(): void
+ {
+ parent::registerRoutes();
+
+ Route::group([
+ 'domain' => config('horizon.domain'),
+ 'prefix' => config('horizon.path'),
+ 'namespace' => 'Vdlp\Horizon\Http\Controllers',
+ 'middleware' => config('horizon.middleware', 'web'),
+ ], static function (): void {
+ Route::get('/{view?}', 'HomeController@index')
+ ->where('view', '(.*)')
+ ->name('horizon.index');
+ });
+ }
}
diff --git a/updates/version.yaml b/updates/version.yaml
index b266c1c..ec71824 100644
--- a/updates/version.yaml
+++ b/updates/version.yaml
@@ -2,3 +2,4 @@ v1.0.0: "First version of Vdlp.Horizon"
v2.0.0: "Removed the dependency of the October CMS module. Moved Horizon Assets. See CHANGELOG for more details."
v2.0.1: "Update plugin documentation"
v2.0.2: "Maintenance release"
+v3.0.0: "Upgrade to Horizon 5.x"
diff --git a/views/layout.blade.php b/views/layout.blade.php
index 081ec80..2685d7a 100644
--- a/views/layout.blade.php
+++ b/views/layout.blade.php
@@ -29,7 +29,8 @@