Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 11 compatibility #7

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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