tiagomichaelsousa / slack-laravel
A slack sdk for laravel
Requires
- php: ^8.1|^8.2
- guzzlehttp/guzzle: ^7
- laravel/framework: ^9|^10
- tiagomichaelsousa/slack-php: ^0
Requires (Dev)
- laravel/pint: ^1.10.1
- pestphp/pest: ^2.6.3
- phpstan/phpstan: ^1.10.18
- rector/rector: ^0.17.2
- symfony/var-dumper: ^6.3.0
README
Slack Laravel is a non-official PHP API package that allows you to interact with the Slack API ⚡️
This package is still under development. There may have methods that are still not implemented.
Get Started
The official documentation for the Slack Client will be available soon. 👀
Until there you can still explore the SDK development experience with the users()
, conversations()
and reminders()
methods 🚀
Requires PHP 8.1+
First, install Slack Laravel via the Composer package manager:
composer require tiagomichaelsousa/slack-laravel
Next, publish the configuration file:
php artisan vendor:publish --provider="Slack\Laravel\ServiceProvider"
This will create a config/slack.php
configuration file in your project, which you can modify to your needs
using environment variables:
SLACK_TOKEN=xoxb-...
Finally, you may use the Slack
facade to access the Slack API:
use Slack\Laravel\Facades\Slack; $conversations = Slack::conversations()->create('foo'); echo $conversations->channel->name;
Usage
For usage examples, take a look at the tiagomichaelsousa/slack-client repository.
Testing
The Slack
facade provides a fake()
method that allows you to fake the API responses.
All responses are having a fake()
method that allows you to easily create a response object by only providing the parameters relevant for your test case.
use Slack\Laravel\Facades\Slack; use Slack\Responses\Conversation\CreateConversationResponse; Slack::fake([ CreateConversationResponse::fake([ 'channel' => [ 'name' => 'foo', ], ]); ]); $conversations = Slack::conversations()->create('foo'); expect($conversations->channel)->name->toBe('foo');
The official documentation for the Slack Client for Laravel will be available soon. 👀
Slack Client for Laravel is an open-sourced software licensed under the MIT license.