Skip to content
This repository has been archived by the owner on Mar 8, 2022. It is now read-only.
/ slack Public archive

A minimal but flexible integration for slack webhooks.

License

Notifications You must be signed in to change notification settings

uptimeproject/slack

Repository files navigation

Codecov GitHub Workflow Status Packagist PHP Version Support Packagist PHP Version Support Packagist Downloads

A minimal but flexible integration for slack webhooks.

How to use

<?php

use UptimeProject\Slack\Workspace;

$workspace = new Workspace('https://hooks.slack.com/services/blablabla');
$workspace->from('John')->send('Hello!');

Adding profile icons

If no icon is given, the default icon for the integration is used.

<?php

use UptimeProject\Slack\Workspace;

$workspace = new Workspace('https://hooks.slack.com/services/blablabla');
// You can use an icon as avatar
$workspace->from('John', ':tophat:')->send('Hello!');

// Or an image from the web
$imgUrl = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png';
$workspace->from('John', $imgUrl)->send('Hello!');

Specifying a channel

If no channel name is given, the default channel for the webhook is used.

<?php

use UptimeProject\Slack\Workspace;

$workspace = new Workspace('https://hooks.slack.com/services/blablabla');

// Send message to a specific channel
$workspace->from('John')->send('Hello!', '#general');

How to contribute

Feel free to create a PR if you have any ideas for improvements. Or create an issue.

  • When adding code, make sure to add tests for it (phpunit).
  • Make sure the code adheres to our coding standards (use php-cs-fixer to check/fix).
  • Also make sure PHPStan does not find any bugs.
vendor/bin/php-cs-fixer fix

vendor/bin/phpstan analyze

vendor/bin/phpunit --coverage-text

These tools will also run in Github Actions on PR's and pushes on master.

About

A minimal but flexible integration for slack webhooks.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages