PHPackages                             lygav/php-slackbot - 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. [API Development](/categories/api)
4. /
5. lygav/php-slackbot

ActiveLibrary[API Development](/categories/api)

lygav/php-slackbot
==================

Simple, easy to use, PHP package for sending messages to Slack. Send pretty, colourful messages with rich attachments quickly with this friendly API

0.0.4(9y ago)39399.9k↓20.1%6MITPHPPHP &gt;=5.3

Since Jul 6Pushed 9y ago5 watchersCompare

[ Source](https://github.com/lygav/php-slackbot)[ Packagist](https://packagist.org/packages/lygav/php-slackbot)[ Docs](https://github.com/lygav/php-slackbot)[ RSS](/packages/lygav-php-slackbot/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (4)Dependencies (1)Versions (5)Used By (0)

PHP-SlackBot [![Packagist](https://camo.githubusercontent.com/98c639ce20c5efd3fef2bb5feff573a332c762bfb586bd6aa1ee52132f283c48/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6c796761762f7068702d736c61636b626f742e737667)](https://packagist.org/packages/lygav/php-slackbot)
======================================================================================================================================================================================================================================================================================================

[](#php-slackbot-)

[![Build Status](https://camo.githubusercontent.com/3aa2363935908640b4201dfaf09d28f7a9665b939a2a8d9e8131233c96fa3006/68747470733a2f2f7472617669732d63692e6f72672f6c796761762f7068702d736c61636b626f742e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/lygav/php-slackbot)![Scrutinizer](https://camo.githubusercontent.com/946293f3765b8e32eed706ecf5ad609e8116e65aa9df061629efc6838d11b2c9/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f6c796761762f7068702d736c61636b626f742e737667)[![Packagist](https://camo.githubusercontent.com/dcdde247c40a6560555ca17d57c56256b16fe658c3875acfbbef2cef1df46c5f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6c796761762f7068702d736c61636b626f742e737667)](https://packagist.org/packages/lygav/php-slackbot)[![Packagist Pre Release](https://camo.githubusercontent.com/b07df310dbc51023d049c3dd8f1e3d0483c40262732b3fa494040d58c7b1ea93/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f767072652f6c796761762f7068702d736c61636b626f742e737667)](https://packagist.org/packages/lygav/php-slackbot)

Simple, easy to use, PHP package for sending messages to Slack.
Send pretty, colourful messages with rich attachments quickly with this friendly API.

Compatible with PHP &gt;= 5.3

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

[](#installation)

### Via composer

[](#via-composer)

```
"require": {
   "lygav/php-slackbot": "0.0.*"
}
```

### Without composer, via PHAR

[](#without-composer-via-phar)

From the command line, enter into the cloned repository dir and run:

```
php makephar

```

You will see that a new file was created named "phpslackbot.phar". Then in your application:

```
include 'path/to/phpslackbot.phar';
```

The rest is the same as when installed with 'composer'

Your first message
------------------

[](#your-first-message)

```
$bot = new Slackbot("https://hooks.slack.com/services/your/incoming/hook");
$bot->text("Hi")->send();
```

Direct messages
---------------

[](#direct-messages)

```
$bot->text("Hi all!")
    ->from("username")
    ->toChannel("mychannel")
    ->send();
```

Create pretty, colorful attachments easily
------------------------------------------

[](#create-pretty-colorful-attachments-easily)

```
$bot->attach(
    $bot->buildAttachment("fallback text")
    ->enableMarkdown()
    ->setText("We can have *mrkdwn* `code` _italic_ also in attachments")
    )
    ->toGroup("mygroup")
    ->send();
```

Customise freely
----------------

[](#customise-freely)

```
$attachment = $bot->buildAttachment("fallback text"/* mandatory by slack */)
    ->setPretext("pretext line")
    ->setText("attachment body text")
    /*
      Human web-safe colors automatically
      translated into HEX equivalent
    */
    ->setColor("lightblue")
    ->setAuthor("me")
    ->addField("short field", "i'm inline", TRUE)
    ->addField("short field 2", "i'm also inline", TRUE)
    ->setImageUrl("http://my-website.com/path/to/image.jpg");

$bot->attach($attachment)->send();
```

Set/ Override every possible setting
------------------------------------

[](#set-override-every-possible-setting)

```
$options = array(
            'username' => 'my-bot-name',
            'icon_emoji' => ':icon name:',
            'icon_url' => 'http://someicon.com',
            'channel' => '#test-channel'
        );

$bot = new Slackbot($url, $options);
$bot->text("check out bot new icon")->send();

// Choose to override 'last minute' (ex. when dealing with multiple consequtive messages)
$bot->text("check out bot new icon")->send(array("username" => "other-bot-name"));
```

Advanced Usage
==============

[](#advanced-usage)

Use custom transfer handlers
----------------------------

[](#use-custom-transfer-handlers)

```
$handler = new MockHandler();
$bot     = new SlackBot($url, ['handler' => $handler]);
$bot->text("some text")
    ->from("my-test-bot")
    ->toGroup("bot-testing")
    ->send();
```

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

Moderate usage in the ecosystem

Community12

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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 ~171 days

Total

4

Last Release

3455d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6170890eb631d001e047f02dca308dd7b5054968ca1979a399de4a6d5fd7ea0e?d=identicon)[lygav](/maintainers/lygav)

---

Top Contributors

[![lygav](https://avatars.githubusercontent.com/u/3002189?v=4)](https://github.com/lygav "lygav (20 commits)")

---

Tags

slackslackbotphp-slackbot

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/lygav-php-slackbot/health.svg)

```
[![Health](https://phpackages.com/badges/lygav-php-slackbot/health.svg)](https://phpackages.com/packages/lygav-php-slackbot)
```

###  Alternatives

[jolicode/slack-php-api

An up to date PHP client for Slack's API

2534.4M12](/packages/jolicode-slack-php-api)[vluzrmos/slack-api

Wrapper for Slack.com WEB API.

102589.1k3](/packages/vluzrmos-slack-api)[botman/driver-slack

Slack driver for BotMan

51267.0k2](/packages/botman-driver-slack)[mpociot/slack-client

A better Slack client, with RTM API support

51263.6k1](/packages/mpociot-slack-client)[lisennk/laravel-slack-events-api

Slack Events API for Laravel 5, 6, 7 and 8

3911.4k](/packages/lisennk-laravel-slack-events-api)[lisennk/laravel-slack-web-api

Light Laravel wrapper for Slack Web API

2117.7k](/packages/lisennk-laravel-slack-web-api)

PHPackages © 2026

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