mcmatters/slack-api

v2.0 2022-07-31 18:22 UTC

This package is auto-updated.

Last update: 2024-10-29 05:10:43 UTC


README

Installation

composer require mcmatters/slack-api

Usage

<?php

use McMatters\SlackApi\Message\Message;
use McMatters\SlackApi\SlackClient;
use McMatters\SlackApi\WebhookClient;

require 'vendor/autoload.php';

// Send message to webhook url.
WebhookClient::send(
    'https://hooks.slack.com/services/YOUR_WEBHOOK_URL',
    Message::make('Hello world')
        ->from('HelloBot')
        ->to('#general')
        ->icon(':rocket:')
);

// Use Slack client wrapper.
$client = new SlackClient('TOKEN');
$client->get('users.info', ['user' => 'W1234567890']);