1. Go to this page and download the library: Download valorin/pinpusher library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
valorin / pinpusher example snippets
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$pin = new Pin(
'example-pin-generic-1',
new DateTime('2015-03-19T18:00:00Z'),
new Pin\Layout\Generic(
"News at 6 o'clock",
Pin\Icon::NOTIFICATION_FLAG
)
);
$pusher = new Pusher()
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
// Generic Layout
$layout = new Pin\Layout\Generic('Client Meeting', Pin\Icon::TIMELINE_CALENDAR);
$layout->setBody('Meeting in Kepler at 4:00pm. Topic: discuss pizza toppings for party.');
// Create Notification
$createNotification = new Pin\Notification\Generic('New Item', Pin\Icon::NOTIFICATION_FLAG);
$createNotification->setBody('A new appointment has been added to your calendar at 4pm.');
// Update Notification
$updateNotification = new Pin\Notification\Generic('Reminder', Pin\Icon::NOTIFICATION_FLAG);
$updateNotification->setTime(new DateTime('2015-03-19T16:00:00Z'))
->setBody('The meeting has been rescheduled to 4pm.');
// Reminders
$reminders = [
new Pin\Reminder\Generic(new DateTime('2015-03-19T14:45:00Z'), 'Meeting in 15 minutes', Pin\Icon::TIMELINE_CALENDAR),
new Pin\Reminder\Generic(new DateTime('2015-03-19T14:55:00Z'), 'Meeting in 5 minutes', Pin\Icon::TIMELINE_CALENDAR),
];
// Actions
$actions = [
new Pin\Action\OpenWatchApp('View Schedule', 15),
new Pin\Action\OpenWatchApp('Show Directions', 22),
];
// Put it all together
$pin = new Pin('meeting-453923', new DateTime('2015-03-19T15:00:00Z'), $layout);
$pin->setDuration(60)
->setCreateNotification($createNotification)
->setUpdateNotification($updateNotification)
->setReminders($reminders)
->setActions($actions);
$pusher = new Pusher()
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$layout = new Pin\Layout\Generic('This is a genericPin!', Pin\Icon::NOTIFICATION_FLAG);
$layout->setPrimaryColor('#FFFFFF') // Pin\Color::WHITE
->setSecondaryColor('#666666') // No official equivalent
->setBackgroundColor('#222222'); // No official equivalent
$pin = new Pin('pin-generic-1', new DateTime('2015-03-18T15:45:00Z'), $layout);
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$layout = new Pin\Layout\Calendar('Pin Layout Meeting');
$layout->setLocationName('Conf Room 1')
->setBody('Discuss layout types with Design Team.');
$pin = new Pin('pin-calendar-1', new DateTime('2015-03-18T15:45:00Z'), $layout);
$pin->setDuration(60);
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$layout = new Pin\Layout\Sports('Bulls at Bears', Pin\Icon::AMERICAN_FOOTBALL, Pin\Icon::AMERICAN_FOOTBALL);
$layout->setRankAway('03')
->setRankHome('08')
->setNameAway('POR')
->setNameHome('LAC')
->setRecordAway('39-19')
->setRecordHome('39-21')
->setScoreAway(54)
->setScoreHome(49)
->setSportsGameState(Pin\Layout\Sports::INGAME)
->setLastUpdated(new DateTime('2015-03-18T18:45:00Z'))
->setSubtitle('Halftime')
->setBody('Game of the Century');
$pin = new Pin('pin-sports-1', new DateTime('2015-03-18T19:00:00Z'), $layout);
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$layout = new Pin\Layout\Weather('Nice day', Pin\Icon::TIMELINE_SUN, Pin\Icon::TIMELINE_SUN, 'Palo Alto');
$layout->setLastUpdated(new DateTime('2015-03-18T18:00:00Z'))
->setSubtitle('40/65')
->setBody('Sunny with a chance of rain.');
$pin = new Pin('pin-weather-1', new DateTime('2015-03-18T19:00:00Z'), $layout);
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$layout = new Pin\Layout\Generic('This is a genericPin!', Pin\Icon::NOTIFICATION_FLAG);
$layout->setSubtitle('With a reminder!.');
$reminder = new Pin\Reminder\Generic(new DateTime('2015-03-18T22:55:00Z'), 'Reminder!', Pin\Icon::ALARM_CLOCK);
$reminder->setLocationName('Conf Rm 1');
$pin = new Pin('pin-generic-reminder-1', new DateTime('2015-03-18T23:00:00Z'), $layout);
$pin->addReminder($reminder);
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$layout = new Pin\Layout\Generic('This is a genericPin!', Pin\Icon::NOTIFICATION_FLAG);
$layout->setSubtitle('With a notification');
$notification = new Pin\Notification\Generic('Notification!', Pin\Icon::NOTIFICATION_FLAG);
$notification->setBody('A new genericPin has appeared!');
$pin = new Pin('pin-generic-createmessage-1', new DateTime('2015-04-30T23:45:00Z'), $layout);
$pin->addReminder($notification);
$pusher->pushToUser($userToken, $pin);
use Valorin\PinPusher\Pusher;
use Valorin\PinPusher\Pin;
$layout = new Pin\Layout\Generic('This is a title', Pin\Icon::NOTIFICATION_REMINDER);
$layout->setBackgroundColor(Pin\Color::PICTON_BLUE)
->setSubtitle('This is a subtitle')
->setBody('This is the body of the main layout...');
$reminder = new Pin\Reminder\Generic(Carbon::now(), 'This is a title', Pin\Icon::NOTIFICATION_REMINDER);
$reminder->setLocationName('Canberra, Australia');
$pin = new Pin('abc-123', $waterPin->time, $layout);
$pin->addReminder($reminder)
->setActions([
new Pin\Action\OpenWatchApp('Yes, I have!', 1),
new Pin\Action\OpenWatchApp('No, not yet...', 2),
]);
$pusher = new Pusher()
$pusher->setLogger($psrCompatibleLogger);
$pusher->pushToUser($userToken, $pin);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.