2017 © Pedro Peláez
 

library slack-api

Simple Slack API client wih predefined methods

image

insidieux/slack-api

Simple Slack API client wih predefined methods

  • Thursday, July 13, 2017
  • by insidieux
  • Repository
  • 3 Watchers
  • 2 Stars
  • 2,223 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 4 Open issues
  • 7 Versions
  • 8 % Grown

The README.md

SlackApi

This project is very outdated and behind the current actual version of php, as well as the current version of the Slack API. We strongly DO NOT RECOMMEND you to use this library and we advise you to switch to one of the published packages from the official Slack documentation - https://api.slack.com/community#php

Build Status Code Climate Test Coverage Codacy Badge Codacy Badge, (*1)

A simple PHP package for making request to Slack API, focused on ease-of-use and elegant syntax., (*2)

Requirements

Installation

You can install the package using the Composer package manager. You can install it by running this command in your project root:, (*3)

composer require insidieux/slack-api

Usage

Create API client, (*4)

$client = new \SlackApi\Client('your-token-here');

Make request, (*5)

$client = new \SlackApi\Client('your-token-here');
$response = $client->request('module.method', ['argument' => 'value']);
$response->toArray();

Or you can use predefined modules and methods, (*6)

$client = new \SlackApi\Client('your-token-here');
$response = $client->users()->getList();
$response->toArray()

Predefined modules: * [channels] (https://api.slack.com/methods#channels) * [chat] (https://api.slack.com/methods#chat) * [dnd] (https://api.slack.com/methods#dnd) * [emoji] (https://api.slack.com/methods#emoji) * [files] (https://api.slack.com/methods#files) * [groups] (https://api.slack.com/methods#groups) * [im] (https://api.slack.com/methods#im) * [oauth] (https://api.slack.com/methods#oauth) * [pins] (https://api.slack.com/methods#pins) * [search] (https://api.slack.com/methods#search) * [team] (https://api.slack.com/methods#team) * [usergroups] (https://api.slack.com/methods#usergroups) * [users] (https://api.slack.com/methods#users), (*7)

Message and attachment objects

Create message object, (*8)

$client = new \SlackApi\Client('your-token-here');
$message = new \SlackApi\Models\Message($client);

or, (*9)

$client = new \SlackApi\Client('your-token-here');
$message = $client->makeMessage();

Create new attachment from array, (*10)

$data = [
    'fallback' => 'Some fallback'
    'pretext'  => 'Some pretext',
    'text'     => 'good',
    'text'     => 'Some text'
]; 
$attachment1 = new \SlackApi\Models\Attachment($data);

Or use set methods, (*11)

$attachment2 = new \SlackApi\Models\Attachment;
$attachment2->setText('Some text')
    ->setColor(\SlackApi\Models\Attachment::COLOR_GOOD)
    ->setFallback('Some fallback');

Add field to attachment, (*12)

$field = new \SlackApi\Models\AttachmentField;
$field->setShort(false)
    ->setTitle('Field title')
    ->setValue('Field value');
$attachment->addField($field);

Attach object to message, (*13)

$message->attach($attachment);

Send message, (*14)

$response = $message->send();
$response->toArray()

Author

The Versions

13/07 2017

dev-master

9999999-dev

Simple Slack API client wih predefined methods

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

The Development Requires

by Ageev Pavel

api curl http client slack slack-sdk slack-api insidieux

13/07 2017

1.3.0

1.3.0.0

Simple Slack API client wih predefined methods

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

The Development Requires

by Ageev Pavel

api curl http client slack slack-sdk slack-api insidieux

06/09 2016

1.2.1

1.2.1.0

Simple Slack API client wih predefined methods

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

The Development Requires

by Ageev Pavel

api curl http client slack slack-sdk slack-api insidieux

13/04 2016

1.2.0

1.2.0.0

Simple Slack API client wih predefined methods

  Sources   Download

MIT

The Requires

  • php >=5.5.0
  • ext-curl *

 

The Development Requires

by Ageev Pavel

api curl http client slack slack-sdk slack-api insidieux

01/04 2016

1.1.0

1.1.0.0

Simple Slack API client wih predefined methods

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ageev Pavel

api curl http client slack insidieux

18/03 2016

1.0.1

1.0.1.0

Simple Slack API client wih predefined methods

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ageev Pavel

api curl http client slack insidieux

18/03 2016

1.0.0

1.0.0.0

Simple Slack API client wih predefined methods

  Sources   Download

MIT

The Requires

 

The Development Requires

by Ageev Pavel

api curl http client slack insidieux