2017 © Pedro Peláez
 

library rocketchat-php

A PHP interface to send incoming webhooks.

image

bt/rocketchat-php

A PHP interface to send incoming webhooks.

  • Wednesday, June 15, 2016
  • by bertramtruong
  • Repository
  • 2 Watchers
  • 3 Stars
  • 2,590 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 30 % Grown

The README.md

rocketchat-php

This library allows you to easily create Incoming Webhooks in for Rocket.Chat in PHP., (*1)

Installing

The recommended way to install rocketchat-php is through Composer., (*2)

composer require bt/rocketchat-php

You can then use rocketchat-php with Composer's auto-loader., (*3)

require 'vendor/autoload.php'

Text Example

A getting started code snippet. This will post a message to the webhook:, (*4)

$client = new \RocketChatPhp\Client('https://demo.rocket.chat', 'webhook_token');
$client->payload([
    'text' => 'This will be sent to the webhook!'
]);

Attachments

You can also add attachments to the message like follows:, (*5)

// Use this to toggle short or long text attachments.
$isShort = true;

$attachment = new \RocketChatPhp\Attachment('The text to be displayed if the client cannot load the attachment.', '#ffffff');
$attachment->addField('Field Title', 'Field Value', $isShort);
$attachment->addField('Field Title2', 'Field Value2', $isShort);

$client = new \RocketChatPhp\Client('https://demo.rocket.chat', 'webhook_token');
$client->payload([
    'text' => 'This is a test message with attachments!',
    'attachments' => [
        $attachment->toArray()
    ]
]);

The Versions

15/06 2016

dev-master

9999999-dev

A PHP interface to send incoming webhooks.

  Sources   Download

MIT

The Requires

 

by Bertram Truong

29/04 2016

1.1

1.1.0.0

A PHP interface to send incoming webhooks.

  Sources   Download

MIT

The Requires

 

by Bertram Truong

27/04 2016

1.0

1.0.0.0

A PHP interface to send incoming webhooks.

  Sources   Download

MIT

The Requires

 

by Bertram Truong