{"id":15024594,"url":"https://github.com/kutia-software-company/larafirebase","last_synced_at":"2025-05-15T17:01:33.599Z","repository":{"id":39406946,"uuid":"333972140","full_name":"kutia-software-company/larafirebase","owner":"kutia-software-company","description":"😍 Laravel Firebase Cloud Messaging. ✍️ Developed by Gentrit Abazi.","archived":false,"fork":false,"pushed_at":"2025-05-03T13:04:44.000Z","size":114,"stargazers_count":374,"open_issues_count":1,"forks_count":83,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-05-10T01:04:29.382Z","etag":null,"topics":["firebase","firebase-cloud-messaging","larafirebase","laravel","laravel-fcm","laravel-firebase","laravel-firebase-push-notification","laravel-push-notifications","laravel-real-time","notifications","php","php-fcm","php-firebase"],"latest_commit_sha":null,"homepage":"","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/kutia-software-company.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-01-28T22:24:24.000Z","updated_at":"2025-04-05T19:55:26.000Z","dependencies_parsed_at":"2023-02-17T15:15:32.803Z","dependency_job_id":"4956d693-1bf3-402b-a217-b0aef6e2db79","html_url":"https://github.com/kutia-software-company/larafirebase","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kutia-software-company%2Flarafirebase","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kutia-software-company%2Flarafirebase/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kutia-software-company%2Flarafirebase/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kutia-software-company%2Flarafirebase/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kutia-software-company","download_url":"https://codeload.github.com/kutia-software-company/larafirebase/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253347092,"owners_count":21894285,"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","firebase-cloud-messaging","larafirebase","laravel","laravel-fcm","laravel-firebase","laravel-firebase-push-notification","laravel-push-notifications","laravel-real-time","notifications","php","php-fcm","php-firebase"],"created_at":"2024-09-24T20:00:37.440Z","updated_at":"2025-05-15T17:01:33.540Z","avatar_url":"https://github.com/kutia-software-company.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"/art/cover.png\" height=\"400\"\u003e\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/kutia-software-company/larafirebase\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/dt/kutia-software-company/larafirebase\" alt=\"Total Downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/kutia-software-company/larafirebase\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/v/kutia-software-company/larafirebase\" alt=\"Latest Stable Version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/kutia-software-company/larafirebase\"\u003e\n        \u003cimg src=\"https://img.shields.io/packagist/l/kutia-software-company/larafirebase\" alt=\"License\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\n### Introduction\n\n**Larafirebase** is a package thats offers you to send push notifications or custom messages via Firebase in Laravel.\n\nFirebase Cloud Messaging (FCM) is a cross-platform messaging solution that lets you reliably deliver messages at no cost.\n\nFor use cases such as instant messaging, a message can transfer a payload of up to 4KB to a client app.\n\n### Installation\n\nFollow the steps below to install the package.\n\n\n**Composer**\n\n```\ncomposer require kutia-software-company/larafirebase\n```\n\n**Copy Config**\n\nRun `php artisan vendor:publish --provider=\"Kutia\\Larafirebase\\Providers\\LarafirebaseServiceProvider\"` to publish the `larafirebase.php` config file.\n\n**Get Athentication Key**\n\nGet Authentication Key from https://console.firebase.google.com/\n\n**Configure larafirebase.php as needed**\n\n```\n'authentication_key' =\u003e '{AUTHENTICATION_KEY}'\n```\n\n### Usage\n\nFollow the steps below to find how to use the package.\n\nExample usage in **Controller/Service** or any class:\n\n```php\nuse Kutia\\Larafirebase\\Facades\\Larafirebase;\n\nclass MyController\n{\n    private $deviceTokens =['{TOKEN_1}', '{TOKEN_2}'];\n\n    public function sendNotification()\n    {\n        return Larafirebase::withTitle('Test Title')\n            -\u003ewithBody('Test body')\n            -\u003ewithImage('https://firebase.google.com/images/social.png')\n            -\u003ewithIcon('https://seeklogo.com/images/F/firebase-logo-402F407EE0-seeklogo.com.png')\n            -\u003ewithSound('default')\n            -\u003ewithClickAction('https://www.google.com')\n            -\u003ewithPriority('high')\n            -\u003ewithAdditionalData([\n                'color' =\u003e '#rrggbb',\n                'badge' =\u003e 0,\n            ])\n            -\u003esendNotification($this-\u003edeviceTokens);\n        \n        // Or\n        return Larafirebase::fromArray(['title' =\u003e 'Test Title', 'body' =\u003e 'Test body'])-\u003esendNotification($this-\u003edeviceTokens);\n    }\n\n    public function sendMessage()\n    {\n        return Larafirebase::withTitle('Test Title')\n            -\u003ewithBody('Test body')\n            -\u003esendMessage($this-\u003edeviceTokens);\n            \n        // Or\n        return Larafirebase::fromArray(['title' =\u003e 'Test Title', 'body' =\u003e 'Test body'])-\u003esendMessage($this-\u003edeviceTokens);\n    }\n}\n```\n\nExample usage in **Notification** class:\n\n```php\nuse Illuminate\\Notifications\\Notification;\nuse Kutia\\Larafirebase\\Messages\\FirebaseMessage;\n\nclass SendBirthdayReminder extends Notification\n{\n    /**\n     * Get the notification's delivery channels.\n     */\n    public function via($notifiable)\n    {\n        return ['firebase'];\n    }\n\n    /**\n     * Get the firebase representation of the notification.\n     */\n    public function toFirebase($notifiable)\n    {\n        $deviceTokens = [\n            '{TOKEN_1}',\n            '{TOKEN_2}'\n        ];\n        \n        return (new FirebaseMessage)\n            -\u003ewithTitle('Hey, ', $notifiable-\u003efirst_name)\n            -\u003ewithBody('Happy Birthday!')\n            -\u003easNotification($deviceTokens); // OR -\u003easMessage($deviceTokens);\n    }\n}\n```\n\n\n### Tips\n- Check example how to receive messages or push notifications in a [JavaScript client](/javascript-client).\n- You can use `larafirebase()` helper instead of Facade.\n\n\n### Payload\n\nCheck how is formed payload to send to firebase:\n\nExample 1:\n\n```php\nLarafirebase::withTitle('Test Title')-\u003ewithBody('Test body')-\u003esendNotification('token1');\n```\n\n```json\n{\n  \"registration_ids\": [\n    \"token1\"\n  ],\n  \"notification\": {\n    \"title\": \"Test Title\",\n    \"body\": \"Test body\"\n  },\n  \"priority\": \"normal\"\n}\n```\n\nExample 2:\n\n```php\nLarafirebase::withTitle('Test Title')-\u003ewithBody('Test body')-\u003esendMessage('token1');\n```\n\n```json\n{\n  \"registration_ids\": [\n    \"token1\"\n  ],\n  \"data\": {\n    \"title\": \"Test Title\",\n    \"body\": \"Test body\"\n  }\n}\n```\n\nIf you want to create payload from scratch you can use method `fromRaw`, for example:\n\n```php\nreturn Larafirebase::fromRaw([\n    'registration_ids' =\u003e ['token1', 'token2'],\n    'data' =\u003e [\n        'key_1' =\u003e 'Value 1',\n        'key_2' =\u003e 'Value 2'\n    ],\n    'android' =\u003e [\n        'ttl' =\u003e '1000s',\n        'priority' =\u003e 'normal',\n        'notification' =\u003e [\n            'key_1' =\u003e 'Value 1',\n            'key_2' =\u003e 'Value 2'\n        ],\n    ],\n])-\u003esend();\n```\n\n---\n\n\u003csup\u003eMade with ♥ by Gentrit Abazi ([@gentritabazi](https://github.com/gentritabazi)).\u003c/sup\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkutia-software-company%2Flarafirebase","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkutia-software-company%2Flarafirebase","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkutia-software-company%2Flarafirebase/lists"}