{"id":15917520,"url":"https://github.com/takuya/php-laravel-mattermost-post","last_synced_at":"2025-04-03T11:41:55.490Z","repository":{"id":56716260,"uuid":"523985826","full_name":"takuya/php-laravel-mattermost-post","owner":"takuya","description":"post mattermost by bot account api as laravel plugin","archived":false,"fork":false,"pushed_at":"2022-08-12T08:34:02.000Z","size":11,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-09T01:14:05.130Z","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-12T06:53:55.000Z","updated_at":"2022-08-12T07:56:22.000Z","dependencies_parsed_at":"2022-08-16T00:10:16.105Z","dependency_job_id":null,"html_url":"https://github.com/takuya/php-laravel-mattermost-post","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-mattermost-post","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-mattermost-post/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-mattermost-post/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-laravel-mattermost-post/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuya","download_url":"https://codeload.github.com/takuya/php-laravel-mattermost-post/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246998102,"owners_count":20866690,"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":[],"created_at":"2024-10-06T18:11:14.165Z","updated_at":"2025-04-03T11:41:55.469Z","avatar_url":"https://github.com/takuya.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-laravel-mattermost-post\npost mattermost by bot account api as laravel plugin\n\n\n## Installing \n```shell\ncd your-laravel-project\ncomposer config repositories.'php-laravel-mattermost-post' \\\n         vcs https://github.com/takuya/php-laravel-mattermost-post.git  \ncomposer require takuya/php-laravel-mattermost-post:master\ncomposer install \n\n```\n\n## Using\n\n```shell\nphp artisan make:notification SampleNotify\nphp artisan make:command MattermostNotifySample\n```\n### app/Notifications/SampleNotify.php\n```php\n\u003c?php\n\nnamespace App\\Notifications;\n\nuse Illuminate\\Bus\\Queueable;\nuse Illuminate\\Notifications\\Notification;\nuse Takuya\\PhpLaravelMattermostPost\\Channels\\MattermostApiChannel;\nuse Takuya\\PhpLaravelMattermostPost\\Messages\\MattermostMessage;\n\nclass SampleNotify extends Notification {\n  use Queueable;\n  \n  public function via ( $notifiable ) {\n    return [MattermostApiChannel::class];\n  }\n  \n  public function toMattermost ( $notifiable ) {\n    $msg = new MattermostMessage();\n    $msg-\u003econtent( \"@takuya Sample notify\" );\n    return $msg;\n  }\n}\n```\n### app/Console/Commands/MattermostNotifySample.php\n```php\n\u003c?php\n\nnamespace App\\Console\\Commands;\n\nuse Illuminate\\Console\\Command;\nuse App\\Notifications\\SampleNotify;\nuse Takuya\\PhpLaravelMattermostPost\\MattermostTeamChannel;\n\nclass MattermostNotifySample extends Command {\n  protected $signature = 'mm:notify';\n  \n  public function handle () {\n    $chn_id = config( 'mattermost.channel' );\n    $chat_room = new MattermostTeamChannel( $chn_id );\n    $chat_room-\u003enotify( new SampleNotify() );\n    return 0;\n  }\n}\n```\n### .env\n```php\nMATTERMOST_BOT_ID=ujkaXXXXXXXXXXXXX\nMATTERMOST_BOT_TOKEN=oxjnXXXXXXXX\nMATTERMOST_URL=https://mm.exmample.com/\nMATTERMOST_CHANNEL_ID=dkt9gqXXXXXXXXXXX\n```\n### config/mattermost.php\n```php\n\u003c?php\nreturn [\n  'channel' =\u003e env( 'MATTERMOST_CHANNEL_ID' ),\n  'token' =\u003e env( 'MATTERMOST_BOT_TOKEN' ),\n  'bot_id' =\u003e env( 'MATTERMOST_BOT_ID' ),\n  'host' =\u003e env( 'MATTERMOST_URL' ),\n];\n```\n### run \n```\nphp artisan mm:notify\n```\n\n### result \n![](https://user-images.githubusercontent.com/55338/184316220-e6d78dc0-3908-4c6a-9647-9684a9b59ff9.png)\n### result with formatting \n![](https://user-images.githubusercontent.com/55338/184316742-c1257e71-0fc5-4c98-9afd-965f63542aa0.png)\n\n\n## Testing\n```shell\n## clone \ngit clone https://github.com/takuya/php-laravel-mattermost-post.git\ncd php-laravel-mattermost-post\ncomposer install\n## prepare \nexport MATTERMOST_BOT_TOKEN=XXXXXoxjno3dXXXX\nexport MATTERMOST_URL=https://mm.exmaple.com/\nexport MATTERMOST_CHANNEL_ID=XXXXdkt9gXXXX\n## post \nvendor/bin/phpunit --filter testPostMattermostChannel_FormattedText\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-laravel-mattermost-post","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuya%2Fphp-laravel-mattermost-post","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-laravel-mattermost-post/lists"}