{"id":26516286,"url":"https://github.com/peterujah/php-firebase-notification","last_synced_at":"2025-03-21T07:16:46.618Z","repository":{"id":57677413,"uuid":"489740461","full_name":"peterujah/php-firebase-notification","owner":"peterujah","description":"A simple php class to help you send firebase push notification from php curl. It will allow you to push cloud messaging through firebase in 3 different way.","archived":false,"fork":false,"pushed_at":"2022-05-13T23:46:24.000Z","size":44,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2023-11-14T12:43:13.777Z","etag":null,"topics":[],"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/peterujah.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":"2022-05-07T17:32:36.000Z","updated_at":"2022-05-14T10:37:38.000Z","dependencies_parsed_at":"2022-09-10T17:20:37.866Z","dependency_job_id":null,"html_url":"https://github.com/peterujah/php-firebase-notification","commit_stats":null,"previous_names":[],"tags_count":2,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fphp-firebase-notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fphp-firebase-notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fphp-firebase-notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterujah%2Fphp-firebase-notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterujah","download_url":"https://codeload.github.com/peterujah/php-firebase-notification/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244571082,"owners_count":20474175,"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":"2025-03-21T07:16:46.121Z","updated_at":"2025-03-21T07:16:46.611Z","avatar_url":"https://github.com/peterujah.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"A simple php class to help you send firebase push notification from php curl. \nIt will allow you to push cloud messaging through firebase in 3 different way.\n \n   1. Send to a single device id\n   2. Send to a multiple device ids\n   3. Send to a specific topic  subscribers\n\nInstallation\n\nInstallation is super-easy via Composer:\n\n```bash \ncomposer require peterujah/php-firebase-notification\n```\n\ninitialize the firebase class with your google api key\n\n```php\nuse Peterujah\\NanoBlock\\FirebaseServiceModel;\nuse Peterujah\\NanoBlock\\FirebaseService;\n\ndefine(\"GOOGLE_FCM_API_KEY\", \"AAAAtXpvsYU:APXXX\");\n$model = new FirebaseServiceModel();\n$service = new FirebaseService(GOOGLE_FCM_API_KEY);\n```\n\nSending a message to a single device id can be done like this.\n\n```php\n$model-\u003esetTo(\"f-bbVq2uCgY:APA91bF0s7jk5lXXy\");\n$model-\u003esetTitle(\"I code it here\");\n$model-\u003esetMessage(\"Will you like to join us?\");\n$response = $service-\u003enotify($model);\nvar_export($response);\n```\n\nSending a message to a multiple user IDs can be done like this\n\n```php\n$model-\u003esetTo(array(\"User-A\", \"User-B\", \"User-C\"));\n$model-\u003esetTitle(\"I code it here\");\n$model-\u003esetMessage(\"Will you like to join us?\");\n$response = $service-\u003enotify($model);\nvar_export($response);\n```\n    \n Sending a message by topic IDs/name can be done like this\n\n```php\n$model-\u003esetIsTopic(FirebaseServiceModel::TOPIC);\n$model-\u003esetTo(\"TOPIC_GROUP_ID_NAME\");\n$model-\u003esetTitle(\"I code it here\");\n$model-\u003esetMessage(\"Will you like to join us?\");\n$response = $service-\u003enotify($model);\nvar_export($response);\n```\n\nMethods\n\nSet the notification payload node type. The default is `FirebaseServiceModel::NODE_NOTIFICATION`\n\n```php \n$model-\u003esetNode(FirebaseServiceModel::NODE_NOTIFICATION | FirebaseServiceModel::NODE_DATA);\n```\n\nSets the notification to send to topic. The default is `false`, pass `FirebaseServiceModel::TOPIC` or `true`, to enable topic.\n```php\n$model-\u003esetIsTopic(FirebaseServiceModel::TOPIC);\n```\n\nSets the notification body, default is message\n```php\n$model-\u003esetBody($body);\n```\nSets the notification image url.\n```php\n$model-\u003esetImage(\"https://img.com/path/to/foo.png\");\n```\n\nSets the notification click action for android.\n```php\n$model-\u003esetClickAction($click);\n```\n\nSets the notification refernce for custom use.\n```php\n$model-\u003esetReference($ref);\n```\n\nSets the notification additional meta data for custom use.\n```php\n$model-\u003esetMeta($array);\n```\n\nSets the notification badge id.\n```php\n$model-\u003esetBadge($int);\n```\n\nSets the notification background state.\n```php\n$model-\u003esetIsBackground($bool);\n```\nSets the notification sound type.\n```php\n$model-\u003esetSound($sound);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fphp-firebase-notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterujah%2Fphp-firebase-notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterujah%2Fphp-firebase-notification/lists"}