PHPackages                             ocolin/slack - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. ocolin/slack

ActiveLibrary[HTTP &amp; Networking](/categories/http)

ocolin/slack
============

Basic PHP Slack Client

v4.0.1(3mo ago)011MITPHPPHP ^8.4

Since Dec 16Pushed 3mo ago1 watchersCompare

[ Source](https://github.com/ocolin/Slack)[ Packagist](https://packagist.org/packages/ocolin/slack)[ Docs](https://github.com/ocolin/Slack)[ RSS](/packages/ocolin-slack/feed)WikiDiscussions main Synced today

READMEChangelogDependencies (10)Versions (10)Used By (0)

PHP Slack Client
================

[](#php-slack-client)

Description
-----------

[](#description)

This is a very small light-weight PHP client for querying the Slack API server. It has no default methods and is just a simple HTTP interface to make your own calls with.

It is meant to be used in conjunction with the API docs found here:

You need to simply paste the desired Slack API method, include any required query parameters, POST body object (if making a POST request), and use the get() or post() method depending on what the Slack method requires.

Installation
------------

[](#installation)

`composer require ocolin/slack`

Requirements
------------

[](#requirements)

In order to use the tool you must provide a Bearer token in order to authenticate with the Slack API server. There are two ways this can be done.

- PHP &gt;= 8.4
- guzzlehttp/guzzle &gt;= 7.10
- ocolin/global-type &gt;= 2.0
- Supplying a token to the constructor
- Using an environment variable.

Instantiating
-------------

[](#instantiating)

### Constructor arguments

[](#constructor-arguments)

- token - Slack authentication token. Optional if using environment variable.
- options - Array of optional Guzzle client settings.

### EXAMPLE: Using environment variable

[](#example-using-environment-variable)

```
// Manual env for demonstration.
$_ENV['SLACK_TOKEN'];
$slack = new Ocolin\Slack\Client();
```

### EXAMPLE: Using all constructor arguments

[](#example-using-all-constructor-arguments)

```
$slack = new Ocolin\Slack\Client(
      token: 'yourtokengoeshere',
    options: [
        'timeout' => 20,
        'verify'  => true
    ]
);
```

Making API calls.
-----------------

[](#making-api-calls)

Once you have your class instantiated, you are ready to make calls. SLack API takes two types of requests, POST and GET. The Post function has parameters for both query and body parameters as some methods may use both at the same time. Both GET and POST parameters can be an associative array or an object.

### EXAMPLE: GET Request

[](#example-get-request)

```
$reqponse = $slack->get(
    method: 'emoji.list'
    query: [ 'include_categories' => false ]
);
```

Expected output:

```
stdClass Object
(
    [ok] => 1
    [emoji] => stdClass Object
        (
            [bowtie] => https://emoji.slack-edge.com/T04KULNSASH/bowtie/f3ec6f2bb0.png
            [squirrel] => https://emoji.slack-edge.com/T04KULNSASH/squirrel/465f40c0e0.png
            [glitch_crab] => https://emoji.slack-edge.com/T04KULNSASH/glitch_crab/db049f1f9c.png
            [piggy] => https://emoji.slack-edge.com/T04KULNSASH/piggy/b7762ee8cd.png
            [cubimal_chick] => https://emoji.slack-edge.com/T04KULNSASH/cubimal_chick/85961c43d7.png
            [dusty_stick] => https://emoji.slack-edge.com/T04KULNSASH/dusty_stick/6177a62312.png
            [slack] => https://emoji.slack-edge.com/T04KULNSASH/slack/7d462d2443.png
            [pride] => https://emoji.slack-edge.com/T04KULNSASH/pride/56b1bd3388.png
            [thumbsup_all] => https://emoji.slack-edge.com/T04KULNSASH/thumbsup_all/50096a1020.png
            [slack_call] => https://emoji.slack-edge.com/T04KULNSASH/slack_call/b81fffd6dd.png
            [shipit] => alias:squirrel
            [white_square] => alias:white_large_square
            [black_square] => alias:black_large_square
            [simple_smile] => https://a.slack-edge.com/80588/img/emoji_2017_12_06/apple/simple_smile.png
        )

    [cache_ts] => 1560987000.000000
)
```

### EXAMPLE: Post Request

[](#example-post-request)

In order to test parameters, we are invoking a test error.

```
$response = $slack->post(
    method: 'api.test',
    params: [ 'error' => 'This is a test' ]
);
```

Output Format
-------------

[](#output-format)

propertytypeDescriptionokBooleanCall was success/failurestatusIntHTTP status codebodyObjectThe full Slack response objecterrorstringError message from server.warningstringWarning from serverretry\_afterintSeconds to wait for rate limitUPDATES NEEDED
--------------

[](#updates-needed)

- Unit testing.
- README revamp

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance81

Actively maintained with recent releases

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~66 days

Recently: every ~24 days

Total

8

Last Release

100d ago

Major Versions

1.1 → 2.12025-12-17

2.1 → 3.02025-12-18

3.2 → v4.0.02026-03-25

PHP version history (2 changes)3.0PHP ^8.2

v4.0.1PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/e97ac0aa452b872ddc3f7f4c56c83852574a27bb74622f8c054d11ca20008fc9?d=identicon)[Ocolin](/maintainers/Ocolin)

---

Top Contributors

[![ocolin](https://avatars.githubusercontent.com/u/8870196?v=4)](https://github.com/ocolin "ocolin (2 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ocolin-slack/health.svg)

```
[![Health](https://phpackages.com/badges/ocolin-slack/health.svg)](https://phpackages.com/packages/ocolin-slack)
```

###  Alternatives

[aws/aws-sdk-php

AWS SDK for PHP - Use Amazon Web Services in your PHP project

6.3k543.5M2.6k](/packages/aws-aws-sdk-php)[neuron-core/neuron-ai

The PHP Agentic Framework.

2.0k656.1k38](/packages/neuron-core-neuron-ai)[illuminate/http

The Illuminate Http package.

11937.9M6.9k](/packages/illuminate-http)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3741.3M47](/packages/tencentcloud-tencentcloud-sdk-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)[guzzlehttp/test-server

Node.js server and PHP controller

14284.0k22](/packages/guzzlehttp-test-server)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
