Download the PHP package mpociot/slack-client without Composer

On this page you can find all versions of the php package mpociot/slack-client. 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 slack-client

PHP Slack API Client

Build Version License Code Coverage Code Quality Downloads

This is an API client for Slack for PHP clients, with support for the Real Time Messaging API (RTM API) using web sockets.

Overview

This library was created primarily for Slackyboy, but was branched off into its own codebase so it could be used in other projects as well. I created this client because existing clients were either too complicated to use, or buggy, or incomplete. This is also the first PHP client I am aware of to support Slack's RTM API.

Installation

Install with Composer, obviously:

Please note that the current version has unstable dependencies.

In order to install those dependencies, you can set "minimum-stability" in your composer.json, and recommend that you set "prefer-stable":

Usage

First, you need to create a client object to connect to the Slack servers. You will need to acquire an API token for your app first from Slack, then pass the token to the client object for logging in. Since this library uses React, you must also pass in an event loop object:

Assuming your token is valid, you are good to go! You can now use wrapper methods for accessing most of the Slack API. Below is an example of posting a message to a channel as the logged in user:

Advanced messages

Slack supports messages much more rich than plain text through attachments. The easiest way to create a custom message is with a MessageBuilder:

Check the API documentation for a list of all methods and properties that messages, attachments, and fields support.

Asynchronous requests and promises

All client requests are made asynchronous using React promises. As a result, most of the client methods return promises. This lets you easily compose request orders and handle them as you need them. Since it uses React, be sure to call $loop->run() or none of the requests will be sent.

React allows the client to perform well and prevent blocking the entire thread while making requests. This is especially useful when writing real-time apps, like Slack chat bots.

Real Time Messaging API

You can also connect to Slack using the Real Time Messaging API. This is often useful for creating Slack bots or message clients. The real-time client is like the regular client, but it enables real-time incoming events. First, you need to create the client:

Then you can use the client as normal; RealTimeClient extends ApiClient, and has the same API for sending requests. You can attach a callback to handle incoming Slack events using RealTimeClient::on():

Below is a very simple, complete example:

See the Slack API documentation for a list of possible events.

Documentation

You can view the complete API documentation here.

Running tests

You can run automated unit tests using PHPUnit after installing dependencies:

Where to get help

Need help? Just send me an email with your questions. Be sure to add "Slack client" to the message subject line so I know how I can help you out.

License

This library is licensed under the MIT license. See the LICENSE file for details.


All versions of slack-client with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
mpociot/phpws Version ^2.0
evenement/evenement Version ~3.0
guzzlehttp/guzzle Version ~6.0
react/event-loop Version ^1.0 || ^0.5 || ^0.4
react/promise Version ^2.2
react/promise-timer Version ^1.2.1
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 mpociot/slack-client contains the following files

Loading the files please wait ....