{"id":25008060,"url":"https://github.com/ntimyeboah/php-slack","last_synced_at":"2026-02-13T12:02:20.446Z","repository":{"id":274869158,"uuid":"924322879","full_name":"NtimYeboah/php-slack","owner":"NtimYeboah","description":"A package to integrate Slack into your PHP applications","archived":false,"fork":false,"pushed_at":"2025-02-08T15:16:40.000Z","size":73,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T16:04:55.413Z","etag":null,"topics":["integration","package","php","slack"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NtimYeboah.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-29T19:50:24.000Z","updated_at":"2025-02-08T15:12:58.000Z","dependencies_parsed_at":"2025-01-29T21:22:52.038Z","dependency_job_id":"d0abf1d9-c406-43b8-88af-97098f447eba","html_url":"https://github.com/NtimYeboah/php-slack","commit_stats":null,"previous_names":["ntimyeboah/php-slack"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NtimYeboah%2Fphp-slack","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NtimYeboah%2Fphp-slack/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NtimYeboah%2Fphp-slack/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NtimYeboah%2Fphp-slack/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NtimYeboah","download_url":"https://codeload.github.com/NtimYeboah/php-slack/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250468273,"owners_count":21435452,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["integration","package","php","slack"],"created_at":"2025-02-05T02:56:50.765Z","updated_at":"2026-02-13T12:02:15.410Z","avatar_url":"https://github.com/NtimYeboah.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"Integrate Slack into your PHP applications\n==========================================\n\n![Build Status](https://github.com/NtimYeboah/php-slack/actions/workflows/test.yml/badge.svg)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE.md)\n\n\nThis package makes it easier to integrate Slack into your PHP application. It provides intuitive and simple API to send simple messages and complex messages using the BlockKit framework.\n\n## Requirements\n\nThis package requires at least [PHP](https://php.net) 8.2.\n\n\n## Installation\n\n```bash\ncomposer require ntimyeboah/php-slack\n```\n\n\n## Basic Usage\n\n### Sending messages\nYou have the option to send messages by configuring the Slack token and channel methods on the SlackMessage object using the `token()` and `channel()` methods respectively.\n```php\nuse NtimYeboah\\PhpSlack\\SlackMessage;\n\n(new SlackMessage)\n    -\u003etoken('xoxb-123abc')\n    -\u003echannel('general')\n    -\u003etext('Hello')\n    -\u003esend();\n```\n\nYou can also configure the Slack token and channel using the Credentials object.\n```php\nuse NtimYeboah\\PhpSlack\\Credentials\n\n$credentials = Credentials::make('general', 'xoxb-123abc');\n\n$slackMessage = new SlackMessage($credentials);\n\n$slackMessage-\u003etext('Hello')\n$slackMessage-\u003esend();\n```\n\n## Advanced Usage\nThis package make it easy to send messages using the BlockKit framework to customize and order the appearance of your messages.\n\n### Sending messages using the Section block\nUse the `section($closure)` method to send a Section block.\n```php\nuse NtimYeboah\\PhpSlack\\Credentials;\nuse NtimYeboah\\PhpSlack\\BlockKit\\Blocks\\Section;\n\n$credentials = Credentials::make('general', 'xoxb-123abc');\n\n(new SlackMessage($credentials))\n    -\u003esection(function (Section $section) {\n        $section-\u003efield('This is a field')-\u003emarkdown();\n        $section-\u003efield('This is another field');\n    })\n    -\u003esend();\n```\nThe above generates these blocks.\n```\n[\n    {\n        \"type\": \"section\",\n        \"fields\": [\n            {\n                \"type\": \"mrkdwn\",\n                \"text\": \"This is a field\"\n            },\n            {\n                \"type\": \"plain_text\",\n                \"text\": \"This is another field\"\n            }\n        ]\n    }\n]\n```\n\n### Sending messages using the Context block\nUse the `context($closure)` method to send a Context block.\n```php\nuse NtimYeboah\\PhpSlack\\Credentials;\nuse NtimYeboah\\PhpSlack\\BlockKit\\Blocks\\Context;\n\n$credentials = Credentials::make('general', 'xoxb-123abc');\n\n(new SlackMessage($credentials))\n    -\u003econtext(function (Context $block) {\n        $block-\u003etext(\"*This* is :smile markdown\")-\u003emarkdown();\n        $block-\u003eimage('http://path/to/image.jpg')-\u003ealtText('cute cat');\n        $block-\u003etext('This is a plain text');\n    })\n    -\u003esend()\n```\nThe above generates these blocks.\n```\n[\n    {\n        \"type\": \"context\",\n        \"elements\": [\n            {\n                \"type\": \"mrkdwn\",\n                \"text\": \"*This* is :smile markdown\"\n            },\n            {\n                \"type\": \"image\",\n                \"image_url\": \"http:\\/\\/path\\/to\\/image.jpg\",\n                \"alt_text\": \"cute cat\"\n            },\n            {\n                \"type\": \"plain_text\",\n                \"text\": \"This is a plain text\"\n            }\n        ]\n    }\n]\n```\n\n### Sending messages using the Header block\nUse the `header($closure)` method to send a Header block.\n```php\nuse NtimYeboah\\PhpSlack\\Credentials;\nuse NtimYeboah\\PhpSlack\\BlockKit\\Blocks\\Header;\n\n$credentials = Credentials::make('general', 'xoxb-123abc');\n\n(new SlackMessage($credentials))\n    -\u003eheader(function (Header $block) {\n        $block-\u003etext('This is a header text');\n    })\n    -\u003esend();\n```\nThe code above generates these blocks.\n```\n[\n    {\n        \"type\": \"header\",\n        \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"This is a header text\"\n        }\n    }\n]\n```\n\n### Sending messages using the RichText block\nUse the `richText($closure)` method to send a Rich Text block.\n```php\nuse NtimYeboah\\PhpSlack\\Credentials;\nuse NtimYeboah\\PhpSlack\\BlockKit\\Blocks\\RichText;\n\n$credentials = Credentials::make('general', 'xoxb-123abc');\n\n(new SlackMessage($credentials))\n    -\u003erichText(function (RichText $block) {\n        $block-\u003etext('This is a text');\n        $block-\u003etext('This is a bold text')-\u003ebold();\n        $block-\u003etext('This is an italic text')-\u003eitalic();\n        $block-\u003etext('This is a strikethrough text')-\u003estrike();\n        $block-\u003eemoji('basketball');\n    })\n    -\u003esend();\n```\nThe above generates these blocks.\n```\n[\n    {\n        \"type\": \"rich_text\",\n        \"elements\": [\n            {\n                \"type\": \"rich_text_section\",\n                \"elements\": [\n                    {\n                        \"type\": \"text\",\n                        \"text\": \"This is a text\"\n                    },\n                    {\n                        \"type\": \"text\",\n                        \"text\": \"This is a bold text\",\n                        \"style\": {\n                            \"bold\": true\n                        }\n                    },\n                    {\n                        \"type\": \"text\",\n                            \"text\": \"This is an italic text\",\n                            \"style\": {\n                                \"italic\": true\n                        }\n                    },\n                    {\n                        \"type\": \"text\",\n                        \"text\": \"This is a strikethrough text\",\n                        \"style\": {\n                            \"strike\": true\n                        }\n                    },\n                    {\n                        \"type\": \"emoji\",\n                        \"name\": \"basketball\"\n                    }\n                ]\n            }\n        ]\n    }\n]\n```\n\n### Sending messages using the Divider block\nUse the `divider()` method to send a Divider block.\n```php\nuse NtimYeboah\\PhpSlack\\Credentials;\n\n$credentials = Credentials::make('general', 'xoxb-123abc');\n\n(new SlackMessage($credentials))\n    -\u003edivider()\n    -\u003esend();\n```\nThe above generates this block.\n```\n[\n    {\n        type\": \"divider\"\n    }\n]\n```\n\n## Consider hiring me\nI am currently seeking new employment opportunities and would appreciate it if you'd keep me in mind for roles such as Backend Developer.\nKindly contact me at: ntimobedyeboah@gmail.com\n\nThis is a link to my CV: [Ntim Yeboah CV](https://docs.google.com/document/d/1jXVsN1NU5AH2XhStxjuwumGIqunoyk0cPPXZr6viaNs/edit?usp=sharing)\n\n\n## Changelog\n\nPlease see [CHANGELOG](https://github.com/NtimYeboah/php-slack/blob/master/CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](https://github.com/NtimYeboah/php-slack/blob/master/CONTRIBUTING.md) for details.\n\n\n## Security\n\nIf you discover a security vulnerability within this package, please send an e-mail to Ntim Yeboah at ntimobedyeboah@gmail.com. All security vulnerabilities will be promptly addressed.\n\n\n## License\n\nPhp Slack is licensed under [The MIT License (MIT)](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntimyeboah%2Fphp-slack","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fntimyeboah%2Fphp-slack","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fntimyeboah%2Fphp-slack/lists"}