Package Data | |
---|---|
Maintainer Username: | keithslater |
Maintainer Contact: | keith@keithslater.com (Keith Slater) |
Package Create Date: | 2014-05-25 |
Package Last Update: | 2014-05-25 |
Home Page: | |
Language: | PHP |
License: | Unknown |
Last Refreshed: | 2024-11-19 03:23:25 |
Package Statistics | |
---|---|
Total Downloads: | 35 |
Monthly Downloads: | 0 |
Daily Downloads: | 0 |
Total Stars: | 7 |
Total Watchers: | 4 |
Total Forks: | 4 |
Total Open Issues: | 0 |
A Laravel package of Easy APNS
Code ported from Easy APNS
Add the following to your composer.json file
"keithslater/easyapns": "dev-master"
Then run composer update
After the project is updated, add the following to your app.php file:
'providers' => array(
'Keithslater\Easyapns\EasyapnsServiceProvider',
);
The following command runs the migration to your database
$ php artisan migrate --package="keithslater/easyapns"
This command copies the config file to app/config/packages/keithslater/easyapns/config.php
$ php artisan config:publish keithslater/easyapns
Upload your development and production .pem files to app/config/packages/keithslater/easyapns/. If you need to convert your certificates to pem certificate files, I recommend following this answer on Stackoverflow.
Modify app/config/packages/keithslater/easyapns/config.php as needed
Finds messages in the database that are still queued and will push them. Sends only first message for device
$ php artisan apns fetch
Similar to fetch but sends all messages for each device
$ php artisan apns flush
You might want to set one of these commands as a cronjob
Add the following to the header where you are calling APNS
use \Keithslater\Easyapns\Easyapns;
Then you will be able to use Easy APNS like normal:
$apns = new Easyapns();
$apns->newMessage(1);
$apns->addMessageAlert('Test message sent');
$apns->queueMessage();
$apns->processQueue();
Refer to Easy APNS for more information.
I recommend setting up a route named something similar to apns. From that route call Easyapns with all input requests. Something similar to this example:
Route::get('apns', function() {
$apns = new Easyapns(Input::all());
});
These few lines of code will respond to the delegate method from your app and add the new device to the database. Just change the host and urlString strings in the app delegate methods to point here.