PHP code example of dav-m85 / pebble-api-php

1. Go to this page and download the library: Download dav-m85/pebble-api-php 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/ */

    

dav-m85 / pebble-api-php example snippets


// Define a pin with an Array
$pin = new PebbleApi\Pin("reservation-1395203", new \DateTime("2014-03-07T09:01:10.229Z"), array(
    "layout" => array(
    	...
    )
));

// Or using object oriented approach (still work in progress)
$layout = new PebbleApi\Layout\GenericLayout();
$layout->setForegroundColor(PebbleApi\LayoutInterface::COLOR_BLUE);
$pin = new PebbleApi\Pin("reservation-1395203", new \DateTime("2014-03-07T09:01:10.229Z"), $layout);
$pin->setDuration(120);

// Then spawn a client
$client = new PebbleApi\Client();

// Create (or update) a pin
$user = new PebbleApi\User($userToken);
$client->put($user, $pin);

// Delete a pin
$client->delete($user, $pin);

// Create a pin for all users (shared pin)
$sharedTopic = new PebbleApi\SharedTopic($apiToken, array('baseball', 'giants'));

$client->put($sharedTopic, $pin);

bash
php composer.phar