Skip to content

Commit

Permalink
Laravel 11 compatibility (#7)
Browse files Browse the repository at this point in the history
  • Loading branch information
stasadev authored Apr 20, 2024
1 parent f7436a9 commit 64c1f54
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/fix-php-code-style-issues.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
ref: ${{ github.head_ref }}

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

- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest]
php: [8.2]
laravel: [10.*]
stability: [prefer-lowest, prefer-stable]
php: [8.3]
laravel: [11.*]
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: ^9.0

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

Expand Down
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ LOG_SLACK_WEBHOOK_URL=https://hooks.slack.com/services/ABC
LOG_SLACK_CHANNEL=
LOG_SLACK_EMOJI=:boom:
LOG_SLACK_CACHE_SECONDS=0
CACHE_DRIVER=file
```

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

```php
// In Laravel 8.x and later
// In Laravel 11.x and later
// bootstrap/app.php
return Application::configure(basePath: dirname(__DIR__))
->withExceptions(function (Exceptions $exceptions) {
$exceptions->reportable(function (Throwable $e) {
\Stasadev\SlackNotifier\Facades\SlackNotifier::send($e);
});
})->create();

// In Laravel 8.x, 9.x, 10.x
// app/Exceptions/Handler.php
public function register(): void
{
Expand Down Expand Up @@ -170,7 +178,7 @@ You can filter it out with the `dont_trace` config option.

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

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.
Use `LOG_SLACK_CACHE_SECONDS` (uses Laravel cache under the hood) to suppress output for X seconds, or pass it to the `cacheSeconds` function.

```php
use Stasadev\SlackNotifier\Facades\SlackNotifier;
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"require": {
"php": "^7.1.3 || ^8.0",
"ext-json": "*",
"laravel/slack-notification-channel": "^1.0 || ^2.0",
"laravel/slack-notification-channel": "^1.0 || ^2.0 || ^3.0",
"monolog/monolog": "^1.12 || ^2.0 || ^3.0",
"symfony/polyfill-php80": "^1.20"
},
Expand Down

0 comments on commit 64c1f54

Please sign in to comment.