Skip to content

Commit

Permalink
Merge branch '11.x' into main
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/tests-php8.yml
#	README.md
#	composer.json
  • Loading branch information
toni-suarez committed Mar 16, 2024
2 parents 666fa44 + decf907 commit a10fbb3
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 21 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/tests-php8.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
40 changes: 26 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down

0 comments on commit a10fbb3

Please sign in to comment.