Download the PHP package mcrumm/phlack without Composer

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

Phlack

Build Status Scrutinizer Quality Score Code Coverage Total Downloads Latest Stable Version Latest Unstable Version License

Phlack eases the creation of Slack Integrations in PHP.

Installation

via composer:

Basic Usage

Send a Message

Advanced Usage

Legacy WebHook URLs

Early versions of Incoming Webhooks used a generic webhook path for all teams. If your webhook URL starts with something like myteam.slack.com, give Phlack your team name and Incoming Webhook token, and it will do the rest:

Factory Method

If you prefer, you can instantiate Phlack via its static factory() method:

New Instance

Besides a webhook url or an array configuration, Phlack will also accept a PhlackClient instance as a constructor argument:

Note: The constructor and factory method both accept the same types of arguments: a string representing the webhook url, an array of client config options, or a PhlackClient object.

:heart: for Guzzle

The PhlackClient is simply a web service client implemented with Guzzle. Examine its service description for more details.

Messages

Messages represent the payload for Slack's Incoming WebHook integration.

Creating Messages

Messages can be created using the provided builders, or they can be instantiated directly.

Message Builder

The MessageBuilder allows for programmatic creation of a Message object.

You can also use the MessageBuilder directly to create the Message object and add Attachments. The MessageBuilder supports method chaining to allow for adding multiple Attachment objects to a single message.

Note: When adding Attachments this way, you must call end() once for each attachment so that the MessageBuilder knows to create the Attachment object and return itself for further modification.

Attachment Builder

If you prefer, you may use the AttachmentBuilder in a standalone fashion:

Message Object

A Message can be instantiated with just a text value:

But you can set optional parameters when constructing the message, too:

Sending Messages

Use Phlack's send() command to fire off the message:

Custom Messages

Custom messages can be sent by using an array of valid parameters:

Note: No input validation is performed on custom message parameters. You are responsible for formatting channels, emojis, and text data yourself.

Message Response

The MessageResponse hash contains the status, reason, and text from the response.

Responses from the Incoming Webhooks Integration are very sparse. Success messages will simply return a status of 200. Error messages will contain more details in the response text and reason.

More Examples

See the examples directory for more use cases.


Slack API

Programmatic access to the Slack API is provided via the ApiClient.

Note: Currently, bearer token authentication is the only supported authentication method. Contributions toward OAuth2 support would be greatly appreciated.

Getting a Client

Get an ApiClient object by instantiating it with a hash containing your API token, or passing a config hash to its factory method.

via factory():

via new ApiClient():

API Methods

The methods currently implemented are:

Consult the client's service description for information on the responses returned by the API methods.

Example: Listing all Channels

Resource Iterators

Example: ListFilesIterator

The ListFilesIterator eases the ability to iterate through multiple pages of data from the Slack API. Using the iterator eliminates the need to manually call the API multiple times to retrieve all pages of the result set.

A complete example is available in the examples directory.

Note: The ListFilesIterator is not strictly necessary to page through file results, but it's certainly easier than the alternative. An example without the iterator is also available.

More API Examples

See the API examples directory for more use cases.


Disclaimer

Any undocumented portion of this library should be considered EXPERIMENTAL AT BEST. Proceed with caution, and, as always, pull requests are welcome.

Credits

The regex in the slack-notifier project.

Contributing

Please see the CONTRIBUTING file for details.

License

Phlack is released under the MIT License. See the bundled LICENSE file for details.


All versions of phlack with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4
guzzle/guzzle Version ~3.8
doctrine/collections Version >=1.0
symfony/options-resolver Version ~2.4|3.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 mcrumm/phlack contains the following files

Loading the files please wait ....