Skip to content

Commit 64c1f54

Browse files
authored
Laravel 11 compatibility (#7)
1 parent f7436a9 commit 64c1f54

File tree

4 files changed

+18
-10
lines changed

4 files changed

+18
-10
lines changed

.github/workflows/fix-php-code-style-issues.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
ref: ${{ github.head_ref }}
2020

2121
- name: Fix PHP code style issues
22-
uses: aglipanci/laravel-pint-action@2.3.0
22+
uses: aglipanci/laravel-pint-action@2.4.0
2323

2424
- name: Commit changes
2525
uses: stefanzweifel/git-auto-commit-action@v5

.github/workflows/run-tests.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest]
16-
php: [8.2]
17-
laravel: [10.*]
18-
stability: [prefer-lowest, prefer-stable]
16+
php: [8.3]
17+
laravel: [11.*]
18+
stability: [prefer-stable]
1919
include:
20-
- laravel: 10.*
21-
testbench: 8.*
20+
- laravel: 11.*
21+
testbench: ^9.0
2222

2323
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2424

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/ABC
3232
LOG_SLACK_CHANNEL=
3333
LOG_SLACK_EMOJI=:boom:
3434
LOG_SLACK_CACHE_SECONDS=0
35-
CACHE_DRIVER=file
3635
```
3736

3837
How to get a webhook URL [in the Slack API docs](https://api.slack.com/messaging/webhooks).
@@ -52,7 +51,16 @@ To send a message to Slack, simply call `SlackNotifier::send()`.
5251
## Report Exception
5352

5453
```php
55-
// In Laravel 8.x and later
54+
// In Laravel 11.x and later
55+
// bootstrap/app.php
56+
return Application::configure(basePath: dirname(__DIR__))
57+
->withExceptions(function (Exceptions $exceptions) {
58+
$exceptions->reportable(function (Throwable $e) {
59+
\Stasadev\SlackNotifier\Facades\SlackNotifier::send($e);
60+
});
61+
})->create();
62+
63+
// In Laravel 8.x, 9.x, 10.x
5664
// app/Exceptions/Handler.php
5765
public function register(): void
5866
{
@@ -170,7 +178,7 @@ You can filter it out with the `dont_trace` config option.
170178

171179
Sometimes a large group of exceptions is thrown, and you don't want to log each of them because they are the same.
172180

173-
Use `LOG_SLACK_CACHE_SECONDS` (uses Laravel `CACHE_DRIVER` under the hood) to suppress output for X seconds, or pass it to the `cacheSeconds` function.
181+
Use `LOG_SLACK_CACHE_SECONDS` (uses Laravel cache under the hood) to suppress output for X seconds, or pass it to the `cacheSeconds` function.
174182

175183
```php
176184
use Stasadev\SlackNotifier\Facades\SlackNotifier;

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"require": {
2020
"php": "^7.1.3 || ^8.0",
2121
"ext-json": "*",
22-
"laravel/slack-notification-channel": "^1.0 || ^2.0",
22+
"laravel/slack-notification-channel": "^1.0 || ^2.0 || ^3.0",
2323
"monolog/monolog": "^1.12 || ^2.0 || ^3.0",
2424
"symfony/polyfill-php80": "^1.20"
2525
},

0 commit comments

Comments
 (0)