Download the PHP package masterro/laravel-slack without Composer

On this page you can find all versions of the php package masterro/laravel-slack. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-slack

Send slack messages and handle interactions with it

Description

This package is used for sending Slack messages and handling interactions with slack messages: clicking on messages buttons and interacting with users through dialogs.

Installition

Install the package via composer:

Install service provider:

Publish config and database migration file:

Run migrations:

This is the contents of the published laravel-slack-plugin.php config file:

Usage

Sending messages

Plugin supports this methods from slack api:

You can inject service Pdffiller\LaravelSlack\Services\LaravelSlackPlugin into your method.

Service has 2 methods:

Instances of these classes can be used as a $method parameter:

Eloquent models can be used as a not obligatory $body parameter.

All sent slack messages via chat.postMessage method are saved in the database in the laravel_slack_message table. Slack message ts and channel are saved for every message. If eloquent model is sent as the $body parameter to the buildMessage method, model's primary key and model's path are also saved. If json options are sent as a $options parameter to the buildMessage method, it will be also saved in the db. You can then use ts and channel parameters in chat.update method in order to update existing slack message.

Sending plain text message

Update slack message

Building messages with attachments

For building messages with attachments plugin has this classes:

Sending message with text attachment

Sending message with attachment including fields

Sending message with attachment including actions

Sending message with file

Open dialogs after messages interaction

Dialog can be opened after interaction with message, for example clicking on a button. After interaction with message, trigger_id is sent in the request payload. This parameter is used in the dialog.open method.

For building dialog plugin has this classes:

Handling Interactive Components

Plugin supports handling interacrtions with buttons and dialogs. All requests from slack are sent to the plugin's endpoint. It's url can be changed in the generated laravel-slack-plugin.php config in the endpoint-url section. This URL should be added to the Interactive Components section in your Slack app. OAuth Access Token and Verification token from Slack App should be added to your config file.

Plugin has convenient system of handlers for processing all interactions. Both Attachment and Dialog have callback_id parameter. After every interaction with button or dialog slack sends request to the /slack/handle endpoint. callback_id parameter is included in the request payload, so all requests can be distinguished by this parameter. So, one handler should be implemented for the requests of one callback_id type.

Plugin has Pdffiller\LaravelSlack\Handlers\BaseHandler class which has this methods:

In your project you should implement your own handlers on top of plugin's BaseHandler class.

Handler example

Handler should be added to the handlers section in the generated laravel-slack-plugin.php config file in your project.


All versions of laravel-slack with dependencies

PHP Build Version
Package Version
Requires fideloper/proxy Version ^4.4
guzzlehttp/guzzle Version >=6.3
illuminate/contracts Version ^5.7|^6.0|^7.0|^8.0
illuminate/support Version ^5.7|^6.0|^7.0|^8.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package masterro/laravel-slack contains the following files

Loading the files please wait ....