displayce / slack-bundle
This bundle provides integration with the Slack API library, allowing you to interact with the Slack API from within your Symfony projects
Installs: 3 123
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 29
Type:symfony-bundle
Requires
- php: >=5.5
- displayce/slack: ^0.23
- symfony/framework-bundle: ^2.3|^3.0|^4.0|^5.0
Requires (Dev)
- dev-master
- 0.23.0
- 0.22.3
- 0.22.2
- 0.22.1
- 0.21.1
- 0.21.0
- 0.20.1
- 0.18.1
- 0.15.4
- 0.15.3
- 0.15.2
- 0.15.1
- 0.14.2
- 0.14.1
- 0.13.2
- 0.13.1
- 0.12.1
- 0.11.1
- 0.10.4
- 0.10.3
- 0.10.2
- 0.10.1
- 0.10.0
- 0.9.6.1
- 0.9.5
- 0.9.4
- 0.9.3
- 0.9.2
- 0.9.1
- 0.8.2
- 0.8.1
- 0.8
- 0.7
- 0.6
- 0.5
- 0.4
- 0.3
- 0.2
- 0.1
- dev-catching-up
- dev-refactored-due-to-factory-removal
- dev-preparing-for-0.12
This package is not auto-updated.
Last update: 2024-10-28 12:21:02 UTC
README
Symfony bundle that integrates the Slack API client by providing easy-to-use services and configuration.
If you would like to access the Slack Web API from the command-line, consider installing the slack-cli package.
Quick example
Here is an example of how you can access the API's chat.postMessage
method to send a message to one of your Slack channels:
<?php // Acme\DemoBundle\Controller\MySlackController public function sendAction() { $payload = new ChatPostMessagePayload(); $payload->setChannel('#general'); // Channel names must begin with a hash-sign '#' $payload->setText('Hello world!'); // also supports Slack formatting $payload->setUsername('acme'); // can be anything you want $payload->setIconEmoji('birthday'); // check out emoji.list-payload for a list of available emojis $response = $this->get('cl_slack.api_client')->send($payload); // display the Slack channel ID on which the message was posted echo $response->getChannel(); // would return something like 'C01234567' // display the Slack timestamp on which the message was posted (note: NON-unix timestamp!) echo $response->getTimestamp(); // would return something like '1407190762.000000' }
In Slack, that should give you something like this in the #general
channel:
These and more examples can be found in the usage documentation.
Documentation
Detailed documentation on how to access each API method can be found in the documentation of the package that this bundle integrates: Slack API library
Thanks
- @fieg, for initial ideas about integrating Slack with our projects.
- The guys at Slack, for making an awesome product and clean documentation.
Contributing
If you would like to contribute to this package, check out the contribution doc here.