Download the PHP package elfsundae/bearychat without Composer

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

BearyChat for PHP

Latest Version on Packagist Build Status StyleCI SensioLabsInsight Quality Score Code Coverage Total Downloads

A PHP package for sending message to BearyChat with the Incoming Webhook, and creating response payload for the Outgoing Robot.

Installation

You can install this package using the Composer manager.

Then you may create an Incoming Robot on your BearyChat team account, and read the payload format.

Documentation

Overview

To send messages, first create a BearyChat client with your webhook URL:

Besides the webhook, you may want to setup some default values for all messages which will be sent with this client:

All defaults keys are listed in MessageDefaults . You can access message default with $client->getMessageDefaults($key), or retrieve all defaults with $client->getMessageDefaults() .

To send a message, just call sendMessage on the client instance with a message payload array or a payload JSON string:

In addition to the ugly payload, sendMessage can handle any JsonSerializable instances or any object which provides a payload via its toArray or toJson method. And there is a ready-made Message class.

For convenience, any unhandled methods called to a Client instance will be sent to a new Message instance, and the most methods of a Message instance return itself, so you can chain message modifications to achieve one-liner code.

You can also call the powerful send or sendTo method with message contents for sending a message.

Message Modifications

Available methods for message modification in the Message class:

As you can see, the to($target) method can change the message's target to an user if $target is started with @ , otherwise it will set the channel that the message should be sent to. The channel's starter mark # is optional in to method, which means the result of to('#dev') and to('dev') is the same.

Method addAttachment($attachment) accepts a PHP array of attachment payload, or a variable arguments list in order of text, title, images, color, and the images can be an image URL or an array contains image URLs. And this type of attachment parameters is also applicable to the method add.

To remove attachments, call removeAttachments or remove with indices.

Message Representation

Call the toArray() method on a Message instance will get the payload array for this message. You may use $message->toJson(), json_encode($message) or (string) $message to get the JSON payload for $message.

:warning: The message payload may be used for requesting an Incoming Webhook or creating response for an Outgoing Robot.

The above example will output:

Sending Message

You can call send or sendTo method on a Message instance to send that message.

The send method optional accepts variable number of arguments to quickly change the payload content:

The sendTo method is useful when you want to change the message's target before calling send method.

Customize Client

If you want to create a Message instance explicitly, the client's createMessage method will return a fresh Message instance configured with the client's message defaults.

A Client instance is mutable, it means you can change its webhook URL or the message defaults by calling setWebhook, webhook or setMessageDefaults.

Testing

License

The BearyChat PHP package is available under the MIT license.


All versions of bearychat with dependencies

PHP Build Version
Package Version
Requires php Version >=5.4.0
ext-mbstring Version *
guzzlehttp/guzzle Version ~5.3|~6.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 elfsundae/bearychat contains the following files

Loading the files please wait ....