Skip to content

Laravel 11.x Compatibility#17

Open
laravel-shift wants to merge 2 commits into
beyondcode:masterfrom
laravel-shift:l11-compatibility
Open

Laravel 11.x Compatibility#17
laravel-shift wants to merge 2 commits into
beyondcode:masterfrom
laravel-shift:l11-compatibility

Conversation

@laravel-shift

Copy link
Copy Markdown

This is an automated pull request from Shift to update your package code and dependencies to be compatible with Laravel 11.x.

Before merging, you need to:

  • Checkout the l11-compatibility branch
  • Review all comments for additional changes
  • Thoroughly test your package

If you do find an issue, please report it by commenting on this PR to help improve future automation.

@laravel-shift

Copy link
Copy Markdown
Author

⚠️ Shift detected GitHub Actions which run jobs using a version matrix. Shift attempted to update your configuration for Laravel 11. However, you should review these changes to ensure the desired combination of versions are built for your package.

@laravel-shift

Copy link
Copy Markdown
Author

⚗️ Using this package? If you would like to help test these changes or believe them to be compatible, you may update your project to reference this branch.

To do so, temporarily add Shift's fork to the repositories property of your composer.json:

{
    "repositories": [
        {
            "type": "vcs",
            "url": "https://github.com/laravel-shift/slack-notification-channel.git"
        }
    ]
}

Then update your dependency constraint to reference this branch:

{
    "require": {
        "beyondcode/slack-notification-channel": "dev-l11-compatibility",
    }
}

Finally, run: composer update

@willpower232

Copy link
Copy Markdown

@mpociot do you need help with this?

@matthewnessworthy

Copy link
Copy Markdown
Contributor

@mpociot would you mind taking a look at this and merging it please?

@willpower232

Copy link
Copy Markdown

If this library is being abandoned in favour of the official laravel library and you want to update to laravel 11 or later, you can reproduce the response functionality with a listener

<?php

namespace App\Listeners;

use Illuminate\Notifications\Events\NotificationSent;

class SlackResponseListener
{
    public function handle(NotificationSent $event): void
    {
        if ($event->channel !== 'slack') {
            return;
        }

        if (! method_exists($event->notification, 'response')) {
            return;
        }

        $event->notification->response($event->response);
    }
}

and then your notification gets the much more useful response class

public function response(\Illuminate\Http\Client\Response $response): void

so you can get at the ts easier with $response->json('ts') rather than having to json_decode the body yourself.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants