orlyapps / laravel-firebase-notifications
通过 API/数据库集成使用 Firebase 发送推送通知
3.0
2022-03-15 05:27 UTC
Requires
- php: ^8.0
- illuminate/support: ^8.0|^9.0
- kreait/firebase-php: ^5.0
Requires (Dev)
- orchestra/testbench: ^5.0
- phpunit/phpunit: ^9.0
This package is auto-updated.
Last update: 2024-09-15 11:03:59 UTC
README
安装
您可以通过 composer 安装此包
composer require orlyapps/laravel-firebase-notifications php artisan migrate
为了生成您的服务账户的私钥文件
- 在 Firebase 控制台中,打开设置>服务账户。
- 点击“生成新私钥”,然后通过点击“生成密钥”进行确认。
- 安全地保存带有密钥的 JSON 文件。
// User.php class User extends Authenticatable { use Notifiable, HasPushTokens; } // services.php 'fcm' => [ 'json_file_path' => storage_path('xxxxx-annxd-xxxx.json'), ] // api.php LaravelFirebaseNotifications::routes();
用法
fetch("http://laravel.test/api/push-token", { headers: { accept: "application/json, text/plain, */*", authorization: "Bearer 25|Zy2O22cipiT1wQWWJ5Dxdp9h2dPKEBNscHkViRa1F7LPIaFMHjr3yR4Q6YVCp6hIRrhcavNGfHcO7EJ6", "content-type": "application/json", }, body: '{"token":"f60Yy793HIWGJAti0PdQKh:APA91bGMhHeCdJLUoleisatgB931pepFq_PJp3smQvXY8ENEDiK9ldL5HhsIQ-4bCaoyd3lxndRjueWcrLhLDccCQ05_objqt4-V9HGceK0xgBsiyGG4atu8xMAi7vnclcAvIZ7G9wB_","type":"web"}', method: "POST", mode: "cors", credentials: "include", });
\App\User::find(1)->notify(new TextNotification('test', 'body', 'https://orlyapps.de'));
Angular 应用用法
npm install firebase @angular/fire -save
变更日志
请参阅 CHANGELOG 了解最近更改的详细信息。
贡献
请参阅 CONTRIBUTING 了解详细信息。
安全
如果您发现任何与安全相关的问题,请通过 info@orlyapps.de 发送电子邮件,而不是使用问题跟踪器。
鸣谢
许可证
MIT 许可证 (MIT)。请参阅 许可证文件 了解更多信息。