{"id":22941783,"url":"https://github.com/zacksleo/laravel-notification-wechat","last_synced_at":"2025-04-01T20:49:51.972Z","repository":{"id":57089055,"uuid":"200009946","full_name":"zacksleo/laravel-notification-wechat","owner":"zacksleo","description":"微信公众号模板消息，微信小程序模板消息","archived":false,"fork":false,"pushed_at":"2019-08-01T15:42:49.000Z","size":13,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-14T00:35:50.327Z","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/zacksleo.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":"2019-08-01T08:27:55.000Z","updated_at":"2019-08-01T15:42:51.000Z","dependencies_parsed_at":"2022-08-20T16:00:46.276Z","dependency_job_id":null,"html_url":"https://github.com/zacksleo/laravel-notification-wechat","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Flaravel-notification-wechat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Flaravel-notification-wechat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Flaravel-notification-wechat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zacksleo%2Flaravel-notification-wechat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zacksleo","download_url":"https://codeload.github.com/zacksleo/laravel-notification-wechat/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709912,"owners_count":20821298,"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-12-14T13:45:02.860Z","updated_at":"2025-04-01T20:49:51.946Z","avatar_url":"https://github.com/zacksleo.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e laravel-notification-wechat \u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e .\u003c/p\u003e\n\n\n## Installing\n\n```shell\n$ composer require zacksleo/laravel-notification-wechat -vvv\n```\n\n## Usage\n\n### 创建通知类\n\n```bash\n$ php artisan make:notification InvoicePaid\n```\n\n```php\nuse Illuminate\\Bus\\Queueable;\nuse Illuminate\\Notifications\\Notification;\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\nuse Zacksleo\\LaravelNotificationWechat\\MiniProgramChannel;\nuse Zacksleo\\LaravelNotificationWechat\\OfficialAccountChannel;\nuse Zacksleo\\LaravelNotificationWechat\\Messages\\MiniProgramTemplateMessage;\nuse Zacksleo\\LaravelNotificationWechat\\Messages\\OfficialAccountTemplateMessage;\n\nclass InvoicePaid extends Notification implements ShouldQueue\n{\n    use Queueable;\n\n    // ...\n}\n```\n\n### 公众号模板消息\n\n```php\npublic function via($notifiable)\n{\n    return [OfficialAccountChannel::class];\n}\n\npublic function toWechatOfficialAccount($notifiable): OfficialAccountTemplateMessage\n{\n    return (new OfficialAccountTemplateMessage)\n    -\u003eto('接收用户的 openid')\n    -\u003etemplate('模板 ID')\n    -\u003eurl('网页地址，如 https://demo.com')\n    -\u003eminiprogram('小程序app_id', '小程序页面路径')\n    -\u003edata([\n        'keyword1' =\u003e '关键词1',\n        'keyword2' =\u003e '关键词2',\n    ]);\n}\n```\n\n### 小程序模板消息\n\n```php\npublic function via($notifiable)\n{\n    return [MiniProgramChannel::class];\n}\n\npublic function toWechatMiniProgram($notifiable): MiniProgramTemplateMessage\n{\n    return (new MiniProgramTemplateMessage)\n    -\u003eto('接收用户的 openid')\n    -\u003etemplate('模板 ID')\n    -\u003eformId('formId 或者 prepay_id')\n    -\u003epage('小程序页面路径')\n    -\u003edata([\n        'keyword1' =\u003e '关键词1',\n        'keyword2' =\u003e '关键词2',\n    ]);\n}\n```\n\n## License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Flaravel-notification-wechat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzacksleo%2Flaravel-notification-wechat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzacksleo%2Flaravel-notification-wechat/lists"}