{"id":15294857,"url":"https://github.com/avto-dev/firebase-notifications-laravel","last_synced_at":"2025-05-07T03:07:54.683Z","repository":{"id":53110281,"uuid":"168291664","full_name":"avto-dev/firebase-notifications-laravel","owner":"avto-dev","description":"Notifications channel for Firebase service","archived":false,"fork":false,"pushed_at":"2024-05-31T11:27:11.000Z","size":87,"stargazers_count":0,"open_issues_count":0,"forks_count":8,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-02T07:24:02.813Z","etag":null,"topics":["firebase","laravel","notifications"],"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/avto-dev.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2019-01-30T06:31:46.000Z","updated_at":"2024-05-31T11:26:52.000Z","dependencies_parsed_at":"2024-10-23T14:02:16.153Z","dependency_job_id":null,"html_url":"https://github.com/avto-dev/firebase-notifications-laravel","commit_stats":{"total_commits":28,"total_committers":10,"mean_commits":2.8,"dds":0.6428571428571428,"last_synced_commit":"1f102da669b95af0f717ebe137ed4cadbca7ee34"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Ffirebase-notifications-laravel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Ffirebase-notifications-laravel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Ffirebase-notifications-laravel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/avto-dev%2Ffirebase-notifications-laravel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/avto-dev","download_url":"https://codeload.github.com/avto-dev/firebase-notifications-laravel/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223801024,"owners_count":17205009,"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":["firebase","laravel","notifications"],"created_at":"2024-09-30T17:07:37.848Z","updated_at":"2024-11-09T08:01:04.561Z","avatar_url":"https://github.com/avto-dev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://laravel.com/assets/img/components/logo-laravel.svg\" alt=\"Laravel\" width=\"240\" /\u003e\n\u003c/p\u003e\n\n\u003e Here's the latest documentation on Laravel Notifications System: \u003chttps://laravel.com/docs/master/notifications\u003e\n\n# Firebase notifications channel for Laravel applications\n\n[![Version][badge_packagist_version]][link_packagist]\n[![PHP Version][badge_php_version]][link_packagist]\n[![Build Status][badge_build_status]][link_build_status]\n[![Coverage][badge_coverage]][link_coverage]\n[![Downloads count][badge_downloads_count]][link_packagist]\n[![License][badge_license]][link_license]\n\nThis package makes it easy to send notifications using [Firebase][firebase_home] with Laravel 5.\n\n## Contents\n\n- [Installation](#installation)\n   - [Setting up the Firebase service](#setting-up-the-Firebase-service)\n- [Usage](#usage)\n   - [Available Message methods](#available-message-methods)\n- [Changelog](#changelog)\n- [Testing](#testing)\n- [Security](#security)\n- [Contributing](#contributing)\n- [Credits](#credits)\n- [License](#license)\n\n\n## Installation\n\n```bash\n$ composer require avto-dev/firebase-notifications-laravel \"^2.0\"\n```\n\n\u003e Installed `composer` is required ([how to install composer][getcomposer]).\n\n\u003e You need to fix the major version of package.\n\nLaravel 5.5 and above uses Package Auto-Discovery, so doesn't require you to manually register the service-provider. Otherwise you must add the service provider to the `providers` array in `./config/app.php`:\n\n```php\n\u003c?php\n\nreturn [\n\n    // ...\n\n    'providers' =\u003e [\n        // ...\n        AvtoDev\\FirebaseNotificationsChannel\\ServiceProvider::class,\n    ],\n\n];\n```\n\n### Setting up the Firebase service\n\nYou need to set up firebase channel in config file `./config/services.php`.\n\n**To generate a private key file for your service account:**\n\n1. In the Firebase console, open **Settings \u003e [Service Accounts][firebase_service_account]**.\n1. Click **Generate New Private Key**, then confirm by clicking **Generate Key**.\n1. Securely store the JSON file containing the key. You'll need this JSON file to complete the next step.\n\nNext select the \"driver\" `file` or `config` contains credintails for [Firebase service account][firebase_service_account] in `./config/services.php`:\n\n```php\n\u003c?php\n\nreturn [\n\n    // ...\n\n    /*\n    |--------------------------------------------------------------------------\n    | Firebase Settings section\n    |--------------------------------------------------------------------------\n    |\n    | Here you may specify some configs for FCM.\n    |\n    */\n\n    'fcm' =\u003e [\n\n        /*\n         |----------------------------------------------------------------------\n         | Firebase service driver\n         |----------------------------------------------------------------------\n         |\n         | Value `file` or `config`:\n         |   - Select `file` option to make service read json file\n         |   - Select `config` option to set up all section in config file\n         |\n         */\n\n        'driver' =\u003e env('FCM_DRIVER', 'config'),\n\n        /*\n         |---------------------------------------------------------------------\n         | FCM Drivers\n         |---------------------------------------------------------------------\n         |\n         | Here are each of the firebase.\n         |\n         */\n\n        'drivers' =\u003e [\n\n            'file' =\u003e [\n                'path' =\u003e env('FCM_FILE_PATH', base_path('storage/fcm.json')),\n            ],\n\n            'config' =\u003e [\n\n                 /*\n                 |------------------------------------------------------------\n                 | Credentials\n                 |------------------------------------------------------------\n                 |\n                 | Content of `firebase.json` file in config. Using if\n                 | `fcm.driver` is `config`. All fields required!\n                 |\n                 */\n\n                'credentials'=\u003e[\n                     'private_key_id'              =\u003e env('FCM_CREDENTIALS_PRIVATE_KEY_ID', 'da80b3bbceaa554442ad67e6be361a66'),\n                     'private_key'                 =\u003e env('FCM_CREDENTIALS_PRIVATE_KEY', '-----BEGIN PRIVATE KEY-----\\n...\\n-----END PRIVATE KEY-----\\n'),\n                     'client_email'                =\u003e env('FCM_CREDENTIALS_CLIENT_EMAIL', 'firebase-adminsdk-mwax6@test.iam.gserviceaccount.com'),\n                     'client_id'                   =\u003e env('FCM_CREDENTIALS_CLIENT_ID', '22021520333507180281'),\n                     'auth_uri'                    =\u003e env('FCM_CREDENTIALS_AUTH_URI', 'https://accounts.google.com/o/oauth2/auth'),\n                     'token_uri'                   =\u003e env('FCM_CREDENTIALS_TOKEN_URI', 'https://oauth2.googleapis.com/token'),\n                     'auth_provider_x509_cert_url' =\u003e env('FCM_CREDENTIALS_AUTH_PROVIDER_CERT', 'https://www.googleapis.com/oauth2/v1/certs'),\n                     'client_x509_cert_url'        =\u003e env('FCM_CREDENTIALS_CLIENT_CERT', 'https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-mwax6%40test.iam.gserviceaccount.com'),\n                ],\n            ],\n        ],\n    ],\n\n];\n```\n\n## Usage\n\nNow you can use the channel in your `via()` method inside the notification as well as send a push notification:\n\n```php\n\u003c?php\n\nuse Illuminate\\Notifications\\Notification;\nuse AvtoDev\\FirebaseNotificationsChannel\\FcmChannel;\nuse AvtoDev\\FirebaseNotificationsChannel\\FcmMessage;\n\nclass AccountApproved extends Notification\n{\n    public function via($notifiable)\n    {\n        return [FcmChannel::class];\n    }\n\n    public function toFcm($notifiable, $notification)\n    {\n        return (new FcmMessage)\n            -\u003esetTitle('Approved!')\n            -\u003esetBody('Your account was approved!');\n    }\n}\n```\n\n```php\n\u003c?php\n\nuse Illuminate\\Notifications\\Notifiable;\nuse AvtoDev\\FirebaseNotificationsChannel\\Receivers\\FcmDeviceReceiver;\nuse AvtoDev\\FirebaseNotificationsChannel\\Receivers\\FcmNotificationReceiverInterface;\n\nclass SomeNotifible\n{\n    use Notifiable;\n\n    /**\n    * Reveiver of firebase notification.\n    *\n    * @return FcmNotificationReceiverInterface\n    */\n    public function routeNotificationForFcm(): FcmNotificationReceiverInterface\n    {\n        return new FcmDeviceReceiver('firebase_token');\n    }\n}\n```\n\n### Available Message methods\n\nThis pakage supports all fields from [HTTP v1 FCM API][http_v1_fcm_api]. Message class contains setters for all the fields:\n\nField     | Type\n:-------: | ----\n`data`    | array\n`title`   | string\n`body`    | string\n`android` | [AndroidFcmPlatformSettings][android_fcm_platform_settings]\n`webpush` | [WebpushFcmPlatformSettings][webpush_fcm_platform_settings]\n`apns`    | [AppleFcmPlatformSettings][apns_fcm_platform_settings]\n\n[PlatformSettings][platform_settings] classes contain platform secific setters\n\n## Testing\n\nFor package testing we use `phpunit` framework. Just write into your terminal _(installed `docker-ce` is required)_:\n\n``` bash\n$ git clone git@github.com:avto-dev/firebase-notifications-laravel.git ./firebase-notifications-laravel \u0026\u0026 cd $_\n$ make install\n$ make test\n```\n\n## Changes log\n\n[![Release date][badge_release_date]][link_releases]\n[![Commits since latest release][badge_commits_since_release]][link_commits]\n\nChanges log can be [found here][link_changes_log].\n\n## Support\n\n[![Issues][badge_issues]][link_issues]\n[![Issues][badge_pulls]][link_pulls]\n\nIf you will find any package errors, please, [make an issue][link_create_issue] in current repository.\n\n## Security\n\nIf you discover any security related issues, please email `jetexe2@gmail.com` instead of using the issue tracker.\n\n## Credits\n\n- [jetexe](https://github.com/jetexe)\n- [All Contributors](../../contributors)\n\n## License\n\nThis is open-sourced software licensed under the [MIT License][link_license].\n\n[badge_packagist_version]:https://img.shields.io/packagist/v/avto-dev/firebase-notifications-laravel.svg?maxAge=180\n[badge_build_status]:https://img.shields.io/github/actions/workflow/status/avto-dev/firebase-notifications-laravel/tests.yml\n[badge_php_version]:https://img.shields.io/packagist/php-v/avto-dev/firebase-notifications-laravel.svg?longCache=true\n[badge_coverage]:https://img.shields.io/codecov/c/github/avto-dev/firebase-notifications-laravel/master.svg?maxAge=60\n[badge_downloads_count]:https://img.shields.io/packagist/dt/avto-dev/firebase-notifications-laravel.svg?maxAge=180\n[badge_license]:https://img.shields.io/packagist/l/avto-dev/firebase-notifications-laravel.svg?longCache=true\n[badge_release_date]:https://img.shields.io/github/release-date/avto-dev/firebase-notifications-laravel.svg?style=flat-square\u0026maxAge=180\n[badge_commits_since_release]:https://img.shields.io/github/commits-since/avto-dev/firebase-notifications-laravel/latest.svg?style=flat-square\u0026maxAge=180\n[badge_issues]:https://img.shields.io/github/issues/avto-dev/firebase-notifications-laravel.svg?style=flat-square\u0026maxAge=180\n[badge_pulls]:https://img.shields.io/github/issues-pr/avto-dev/firebase-notifications-laravel.svg?style=flat-square\u0026maxAge=180\n\n[link_releases]:https://github.com/avto-dev/firebase-notifications-laravel/releases\n[link_packagist]:https://packagist.org/packages/avto-dev/firebase-notifications-laravel\n[link_build_status]:https://github.com/avto-dev/firebase-notifications-laravel/actions\n[link_coverage]:https://codecov.io/gh/avto-dev/firebase-notifications-laravel/\n[link_changes_log]:https://github.com/avto-dev/firebase-notifications-laravel/blob/master/CHANGELOG.md\n[link_issues]:https://github.com/avto-dev/firebase-notifications-laravel/issues\n[link_create_issue]:https://github.com/avto-dev/firebase-notifications-laravel/issues/new/choose\n[link_commits]:https://github.com/avto-dev/firebase-notifications-laravel/commits\n[link_pulls]:https://github.com/avto-dev/firebase-notifications-laravel/pulls\n[link_license]:https://github.com/avto-dev/firebase-notifications-laravel/blob/master/LICENSE\n[getcomposer]:https://getcomposer.org/download/\n\n[firebase_home]:https://firebase.google.com/\n[firebase_service_account]:https://console.firebase.google.com/project/_/settings/serviceaccounts/adminsdk\n[http_v1_fcm_api]:https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource-message\n\n[android_fcm_platform_settings]:./src/PlatformSettings/AndroidFcmPlatformSettings.php\n[webpush_fcm_platform_settings]:./src/PlatformSettings/WebpushFcmPlatformSettings.php\n[apns_fcm_platform_settings]:./src/PlatformSettings/AppleFcmPlatformSettings.php\n[platform_settings]:./src/PlatformSettings\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favto-dev%2Ffirebase-notifications-laravel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Favto-dev%2Ffirebase-notifications-laravel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Favto-dev%2Ffirebase-notifications-laravel/lists"}