{"id":15031818,"url":"https://github.com/davibennun/laravel-push-notification","last_synced_at":"2025-05-14T14:08:18.103Z","repository":{"id":13040061,"uuid":"15719909","full_name":"davibennun/laravel-push-notification","owner":"davibennun","description":"Laravel package to enable sending push notifications to devices","archived":false,"fork":false,"pushed_at":"2023-05-04T03:32:33.000Z","size":25,"stargazers_count":1234,"open_issues_count":113,"forks_count":255,"subscribers_count":53,"default_branch":"master","last_synced_at":"2025-05-11T11:38:05.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/davibennun.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2014-01-07T23:29:45.000Z","updated_at":"2025-05-09T10:52:27.000Z","dependencies_parsed_at":"2022-09-07T14:11:26.461Z","dependency_job_id":"b3e60790-a3a6-404e-89c4-4845c897c4fb","html_url":"https://github.com/davibennun/laravel-push-notification","commit_stats":{"total_commits":24,"total_committers":9,"mean_commits":"2.6666666666666665","dds":0.5,"last_synced_commit":"f2a7855018900688fd5d3e4bd43ec3555289e005"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davibennun%2Flaravel-push-notification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davibennun%2Flaravel-push-notification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davibennun%2Flaravel-push-notification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/davibennun%2Flaravel-push-notification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/davibennun","download_url":"https://codeload.github.com/davibennun/laravel-push-notification/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253763926,"owners_count":21960484,"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":"2024-09-24T20:16:40.982Z","updated_at":"2025-05-14T14:08:18.084Z","avatar_url":"https://github.com/davibennun.png","language":"PHP","funding_links":[],"categories":["通知( Notifications )"],"sub_categories":[],"readme":"Laravel Push Notification\n=========\n\nPackage to enable sending push notifications to devices\n\nInstallation\n----\n\nUpdate your `composer.json` file to include this package as a dependency\n\nLaravel 5 \u0026 Lumen\n\n```json\n\"davibennun/laravel-push-notification\": \"dev-laravel5\"\n```\nLaravel 4.*\n```json\n\"davibennun/laravel-push-notification\": \"dev-master\"\n```\n\nRegister the PushNotification service provider by adding it to the providers array.\n```php\n'providers' =\u003e array(\n\t...\n\t'Davibennun\\LaravelPushNotification\\LaravelPushNotificationServiceProvider'\n)\n```\n\nAlias the PushNotification facade by adding it to the aliases array in the `app/config/app.php` file.\n```php\n'aliases' =\u003e array(\n\t...\n\t'PushNotification' =\u003e 'Davibennun\\LaravelPushNotification\\Facades\\PushNotification'\n)\n```\n\n# Configuration\n\nCopy the config file into your project by running: (Lumen users skip this)\n\nLaravel 5\n```php\nphp artisan vendor:publish --provider=\"Davibennun\\LaravelPushNotification\\LaravelPushNotificationServiceProvider\" --tag=\"config\"\n```\n\nLaravel 4.*\n```\nphp artisan config:publish davibennun/laravel-push-notification\n```\n\nThis will generate a config file like this\n```php\narray(\n    'appNameIOS'=\u003earray(\n\t\t'environment' =\u003e 'development',\n\t\t'certificate' =\u003e '/path/to/certificate.pem',\n\t\t'passPhrase'  =\u003e 'password',\n\t\t'service'     =\u003e 'apns'\n    ),\n    'appNameAndroid'=\u003earray(\n\t\t'environment' =\u003e 'production',\n\t\t'apiKey'      =\u003e 'yourAPIKey',\n\t\t'service'     =\u003e 'gcm'\n    )\n);\n```\nWhere all first level keys corresponds to an service configuration, each service has its own properties, android for instance have `apiKey` and IOS uses `certificate` and `passPhrase`. You can set as many services configurations as you want, one for each app.\n\n##### Dont forget to set `service` key to identify IOS `'service'=\u003e'apns'` and Android `'service'=\u003e'gcm'`\n\n##### The certificate path must be an absolute path, so in the configuration file you can use these:\n```\n//Path to the 'app' folder\n'certificate'=\u003eapp_path().'/myCert.pem'\n```\nLaravel functions are also available `public_path()` `storage_path()` `base_path()`\n\n# Usage\n```php\n\nPushNotification::app('appNameIOS')\n                -\u003eto($deviceToken)\n                -\u003esend('Hello World, i`m a push message');\n\n```\nWhere app argument `appNameIOS` refers to defined service in config file.\n\n### Dynamic configuration and Lumen users\nYou can set the app config array directly: (keep in mind the array schema)\n```php\n//iOS app\nPushNotification::app(['environment' =\u003e 'development',\n\t\t'certificate' =\u003e '/path/to/certificate.pem',\n\t\t'passPhrase'  =\u003e 'password',\n\t\t'service'     =\u003e 'apns']);\n//Android app\t\t\nPushNotification::app(['environment' =\u003e 'production',\n\t\t'apiKey'      =\u003e 'yourAPIKey',\n\t\t'service'     =\u003e 'gcm']);\n\n```\n\n\nTo multiple devices and optioned message:\n```php\n$devices = PushNotification::DeviceCollection(array(\n    PushNotification::Device('token', array('badge' =\u003e 5)),\n    PushNotification::Device('token1', array('badge' =\u003e 1)),\n    PushNotification::Device('token2')\n));\n$message = PushNotification::Message('Message Text',array(\n    'badge' =\u003e 1,\n    'sound' =\u003e 'example.aiff',\n    \n    'actionLocKey' =\u003e 'Action button title!',\n    'locKey' =\u003e 'localized key',\n    'locArgs' =\u003e array(\n        'localized args',\n        'localized args',\n    ),\n    'launchImage' =\u003e 'image.jpg',\n    \n    'custom' =\u003e array('custom data' =\u003e array(\n        'we' =\u003e 'want', 'send to app'\n    ))\n));\n\n$collection = PushNotification::app('appNameIOS')\n    -\u003eto($devices)\n    -\u003esend($message);\n\n// get response for each device push\nforeach ($collection-\u003epushManager as $push) {\n    $response = $push-\u003egetAdapter()-\u003egetResponse();\n}\n\n// access to adapter for advanced settings\n$push = PushNotification::app('appNameAndroid');\n$push-\u003eadapter-\u003esetAdapterParameters(['sslverifypeer' =\u003e false]);\n```\nThis package is wrapps [Notification Package] and adds some flavor to it.\n\n#### Usage advice\nThis package should be used with [Laravel Queues], so pushes dont blocks the user and are processed in the background, meaning a better flow.\n\n\n\n[Notification Package]:https://github.com/Ph3nol/NotificationPusher\n[Laravel Queues]:http://laravel.com/docs/queues\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavibennun%2Flaravel-push-notification","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdavibennun%2Flaravel-push-notification","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdavibennun%2Flaravel-push-notification/lists"}