{"id":20668674,"url":"https://github.com/coder966/fcm-simple","last_synced_at":"2025-04-19T18:07:23.521Z","repository":{"id":56955597,"uuid":"61332011","full_name":"coder966/fcm-simple","owner":"coder966","description":"PHP API for Firebase Cloud Messaging (FCM)","archived":false,"fork":false,"pushed_at":"2019-06-23T08:17:03.000Z","size":120,"stargazers_count":13,"open_issues_count":2,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-10-12T05:10:33.647Z","etag":null,"topics":["fcm","fcm-http","firebase","firebase-cloud-messaging","gcm","php"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/coder966.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-06-16T23:25:33.000Z","updated_at":"2023-04-24T00:37:31.000Z","dependencies_parsed_at":"2022-08-21T04:00:13.210Z","dependency_job_id":null,"html_url":"https://github.com/coder966/fcm-simple","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Ffcm-simple","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Ffcm-simple/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Ffcm-simple/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/coder966%2Ffcm-simple/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/coder966","download_url":"https://codeload.github.com/coder966/fcm-simple/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224817789,"owners_count":17374965,"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":["fcm","fcm-http","firebase","firebase-cloud-messaging","gcm","php"],"created_at":"2024-11-16T20:10:48.872Z","updated_at":"2024-11-16T20:10:49.534Z","avatar_url":"https://github.com/coder966.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FCMSimple\n\n[![Latest Stable Version](https://poser.pugx.org/coder966/fcm-simple/v/stable)](https://packagist.org/packages/coder966/fcm-simple)\n[![License](https://poser.pugx.org/coder966/fcm-simple/license)](https://packagist.org/packages/coder966/fcm-simple)\n\nA PHP library to send messages to devices registered through Firebase Cloud Messaging (FCM).\n\nFeatures:\n- Lightweight \u0026 simple\n- Zero dependencies\n- Implemented using cURL\n- Support sending to topics and tokens\n- Support various message options like `CollapseKey`, `Priority`, `TimeToLive` and more\n- Provides you with the tokens you should update/remove from your database\n\n\n## Usage\nFor further details, see the [Wiki](https://github.com/coder966/FCMSimple/blob/master/Wiki.md \"Wiki\")\n### Installation\nYou need PHP \u003e= 5.4\n```\n$ composer require coder966/fcm-simple\n```\n\n### PHP Server\n```php\nrequire 'vendor/autoload.php';\n\nuse FCMSimple\\Client;\nuse FCMSimple\\Message;\n\n// create the client\n$client = new Client(\"YOUR_SERVER_KEY\");\n\n// create the message\n$msg = new Message();\n$msg-\u003eput(\"key1\", \"value1\");\n$msg-\u003eput(\"key2\", \"value2\");\n\n// send the message to a specific topic\n$client-\u003esendToTopic($msg, \"my_topic\");\n\n// or you can send to specific devices using their registration tokens\n// so first prepare your array of tokens, typically retrieve from DB\n$tokens = [\n    \"token_1\",\n    \"token_2\",\n    \"token_3\"\n];\n// and send\n$client-\u003esendToTokens($msg, $tokens);\n```\n\n### Android Client\nIn the service that extends `FirebaseMessagingService`, in method `onMessageReceived`, use:\n```java\nMap\u003cString, String\u003e msg = remoteMessage.getData();\nString value1 = msg.get(\"key1\");\nString value2 = msg.get(\"key2\");\n```\n\n\n## License\n\n```\nCopyright 2016 Khalid H. Alharisi\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n    http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder966%2Ffcm-simple","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcoder966%2Ffcm-simple","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcoder966%2Ffcm-simple/lists"}