diff --git a/.github/workflows/tests-php8.yml b/.github/workflows/tests-php8.yml index 94dc602..186c0ed 100644 --- a/.github/workflows/tests-php8.yml +++ b/.github/workflows/tests-php8.yml @@ -17,8 +17,11 @@ jobs: strategy: matrix: - laravel: ['10.*'] - php: [8.1, 8.2] + laravel: ['11.*'] + php: [8.1, 8.2, 8.3] + exclude: + - laravel: '11.*' + php: 8.1 fail-fast: false name: Laravel ${{ matrix.laravel }}, PHP ${{ matrix.php }} diff --git a/README.md b/README.md index cc9c736..2ea0c3f 100644 --- a/README.md +++ b/README.md @@ -48,26 +48,38 @@ $ composer require suarez/laravel-utm-parameter ### Middleware -Open the `app/Http/Kernel.php` file and add a new item to the `web` middleware group: +Open the `bootstrap/app.php` file and append the `UtmParameters::class` inside the web-group ```php -# Laravel 10 -protected $middlewareGroups = [ - 'web' => [ - /* ... keep the existing middleware here */ - \Suarez\UtmParameter\Middleware\UtmParameters::class, - ], -]; +# Laravel 11 +return Application::configure(basePath: dirname(__DIR__)) + ... + ->withMiddleware(function (Middleware $middleware) { + $middleware->web(append: [ + Suarez\UtmParameter\Middleware\UtmParameters::class, + /* ... keep the existing middleware here */ + ]); + }) + ... ``` -To enable UTM-Parameters only for certain requests to your site, add a new mapping to the `routeMiddleware` Array. +To enable UTM-Parameters only for certain requests to your site, add a new alias. ```php -# Laravel 10 -protected $middlewareAliases = [ - /* ... keep the existing mappings here */ - 'utm-parameters' => \Suarez\UtmParameter\Middleware\UtmParameters::class, -]; +# Laravel 11 +use Suarez\UtmParameter\Middleware\UtmParameters; + +->withMiddleware(function (Middleware $middleware) { + $middleware + ->alias([ + /* ... keep the existing mappings here */ + 'utm-parameters' => UtmParameters::class, + ]) + ->web(append: [ + /* ... keep the existing mappings here */ + UtmParameters::class + ]); +}) ``` To apply UTM-Parameters to specific routes, use the following middleware: `utm-parameters` diff --git a/composer.json b/composer.json index 8646d87..e52084b 100644 --- a/composer.json +++ b/composer.json @@ -11,13 +11,13 @@ } ], "require": { - "php": "^8.1", - "illuminate/support": "^10.0", - "illuminate/contracts": "^10.0" + "php": "^8.2", + "illuminate/support": "^11.0", + "illuminate/contracts": "^11.0" }, "require-dev": { - "nunomaduro/collision": "^7.0", - "orchestra/testbench": "^8.0", + "nunomaduro/collision": "^8.1", + "orchestra/testbench": "^9.0", "phpunit/phpunit": "^9.5|^10.0", "friendsofphp/php-cs-fixer": "^3.0" },