Skip to content

discolabs/urbit-client-php

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Alt text

urbit-client-php


PHP client library for urb-it integration.

Installing

The recommended way to install the urb-it PHP client is through Composer:

# Install Composer
curl -sS https://getcomposer.org/installer | php

Next, run the Composer command to install the latest version of the urb-it PHP client:

php composer.phar require urbit/client:dev-master

After installing, you need to require Composer's auto-loader:

require __DIR__ . '/vendor/autoload.php';

You can later update the PHP client using composer:

composer.phar update

Legacy Version

For the legacy version of the PHP client, please see the legacy branch or release v0.1.

Usage

$storeKey = '<store key>';
$sharedSecret = '<shared secret>';
$client = new Urbit\Client($storeKey, $sharedSecret);

$openingHours = $client->getOpeningHours('2016-05-21', '2016-05-28');

$validPostalCode = $client->validatePostalCode('113 30');

$order = [...];
$createOrderResponse = $client->createOrder($order);
$validateDeliveryResponse = $client->validateDelivery($order);

Or if you only need UWA and not the full client:

$storeKey = '<store key>';          // Store key
$sharedSecret = '<shared secret>';  // Shared secret
$method = 'GET';                    // HTTP method, like GET, POST, PUT, DELETE
$url = '';                          // Full HTTP request URL
$json = '';                         // JSON body, if any
$uwa = new Urbit\Auth\UWA($storeKey, $sharedSecret, $method, $url, $json);

One can also override the base URL:

$client = new Urbit\Client('<store key>', '<shared secret>');
$client->baseUrl = 'https://another-api.com/v1/';

$client->request('GET', 'orders'); // Sends a GET request to https://another-api.com/v1//orders

Documentation

Maintainers & Contributors

About

PHP client library for urb-it integration

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages