{"id":15917517,"url":"https://github.com/takuya/php-laravel-slack-post","last_synced_at":"2025-10-06T00:54:54.647Z","repository":{"id":56714867,"uuid":"523963606","full_name":"takuya/php-laravel-slack-post","owner":"takuya","description":"slack post by bot account as laravel plugin","archived":false,"fork":false,"pushed_at":"2022-08-13T20:13:17.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-03T11:44:42.330Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/takuya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-08-12T05:16:58.000Z","updated_at":"2022-08-12T05:25:54.000Z","dependencies_parsed_at":"2022-08-16T00:00:56.333Z","dependency_job_id":null,"html_url":"https://github.com/takuya/php-laravel-slack-post","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/takuya/php-laravel-slack-post","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-slack-post","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-slack-post/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-slack-post/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-slack-post/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuya","download_url":"https://codeload.github.com/takuya/php-laravel-slack-post/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-slack-post/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278542671,"owners_count":26004061,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-10-06T18:11:13.325Z","updated_at":"2025-10-06T00:54:54.628Z","avatar_url":"https://github.com/takuya.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-laravel-slack-post\nslack post by bot account as laravel plugin\n\n\n## Installing\n\n```sh\ncomposer config repositories.'php-laravel-slack-post' \\\n         vcs https://github.com/takuya/php-laravel-slack-post  \ncomposer require takuya/php-laravel-slack-post:master\ncomposer install \n```\n## Using \n```sh\nphp artisan make:notification SampleNotify\nphp artisan make:command SlaclNotifySample\n```\n#### app/Notification/SampleNotify.php\n```php\n\u003c?php\n\nnamespace App\\Notifications;\n\nuse Illuminate\\Bus\\Queueable;\nuse Illuminate\\Notifications\\Notification;\nuse Takuya\\PhpLaravelSlackPost\\SlackWorkSpaceChannel;\nuse Illuminate\\Notifications\\Messages\\SlackMessage;\nuse Takuya\\PhpLaravelSlackPost\\Channel\\SlackChannelPostByBotAPI;\n\nclass SampleNotify extends Notification {\n  use Queueable;\n  \n  protected $username = 'サンプル通知';\n  public function via ( $notifiable ) {\n    return [SlackChannelPostByBotAPI::class];\n  }\n  \n  /**\n   * @param SlackWorkSpaceChannel $notifiable\n   * @return \\Illuminate\\Notifications\\Messages\\SlackMessage\n   */\n  public function toSlack ( SlackWorkSpaceChannel $notifiable ): SlackMessage {\n    $message = new SlackMessage();\n    $message-\u003efrom( $this-\u003eusername )\n            -\u003eto( $notifiable-\u003egetChannelName() )\n            -\u003econtent('Hello World');\n    return $message;\n  }\n}\n```\n### app/Commands/SlackNotifySample.php\n\n```php\n\u003c?php\n\nnamespace App\\Console\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse Takuya\\PhpLaravelSlackPost\\SlackWorkSpaceChannel;\nuse App\\Notifications\\SampleNotify;\n\nclass SlaclNotifySample extends Command {\n  protected $signature = 'slack:notify';\n  \n  public function handle () {\n    $slack = new SlackWorkSpaceChannel(config('slack.channel_id'));\n    $slack-\u003enotify( new SampleNotify() );\n  }\n}\n```\n### .env\n```\nSLACK_TOKEN=xoxb-12xxxxxxxxxxxxxx---xxx\nSLACK_CHANNEL_NAME=通知テスト用\nSLACK_CHANNEL_ID=C01AXXXXX\n```\n### config/slack.php\n```php\n\u003c?php\n\nreturn [\n  'token'=\u003eenv('SLACK_TOKEN'),\n  'channel_id'=\u003eenv('SLACK_CHANNEL_ID'),\n  'channel_name'=\u003eenv('SLACK_CHANNEL_NAME'),\n];\n```\n### run\n```sh\nphp artisan slack:notify\n```\n\n### result \n\n![](https://user-images.githubusercontent.com/55338/184298814-74c1e7dd-46e0-407b-9722-a29e93eb093b.png)\n\n## testing \n```sh\n## prepare\ngit clone https://github.com/takuya/php-laravel-slack-post\ncd php-laravel-slack-post\ncomposer install\n## test\nexport SLACK_TOKEN=xoxb-XXXXX-XXXXXXXXXQoOS5sOv\nexport SLACK_CHANNEL_NAME='#通知テスト'\nexport SLACK_CHANNEL_ID=C01AXXXXX\nvendor/bin/phpunit --filter testPostSlackChannel     \n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-laravel-slack-post","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuya%2Fphp-laravel-slack-post","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-laravel-slack-post/lists"}