PHP code example of steedy / steedy-client-api-php

1. Go to this page and download the library: Download steedy/steedy-client-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/ */

    

steedy / steedy-client-api-php example snippets


$client_id = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'; // contact us at [email protected] to initiate your API access
$client_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
$api = new \Steedy\API($client_id, $client_secret);
// to use the sandbox for testing:
// $api = new \Steedy\API($client_id, $client_secret, 'v1-sandbox');
$api->auth();

$delivery_quote = $api->post('delivery/create', array(
    'origin_name' => 'Thomas Rambaud',
    'origin_tel' => '0600000000',
    'origin_email' => '[email protected]',
    'origin_address' => 'Rue de Rivoli, 75001 Paris',
    'origin_commentary' => 'iMac 27 to deliver',
    'destinations' => array(
        array(
            'name' => 'Pierre Guerin',
            'address' => '16 avenue Reille, 75014 Paris',
            'tel' => '0600000000',
            'email' => '[email protected]',
        )
    )
    'delivery_size' => 3
));

$delivery_quote = $api->post('delivery/create', array(
    'origin_name' => 'Thomas Rambaud',
    'origin_tel' => '0600000000',
    'origin_email' => '[email protected]',
    'origin_address' => 'Rue de Rivoli, 75001 Paris',
    'origin_commentary' => 'iMac 27 to deliver',
    'destinations' => array(
        array(
            'name' => 'Pierre Guerin',
            'address' => '16 avenue Reille, 75014 Paris',
            'tel' => '0600000000',
            'email' => '[email protected]',
        )
    )
    'delivery_size' => 3,
    'schedule_at' => 1511710610
));

$delivery_quote = $api->post('delivery/create', array(
    'origin_name' => 'Thomas Rambaud',
    'origin_tel' => '0600000000',
    'origin_email' => '[email protected]',
    'origin_address' => 'Rue de Rivoli, 75001 Paris',
    'origin_commentary' => 'iMac 27 to deliver',
    'destinations' => array(
        array(
            'name' => 'Pierre Guerin',
            'address' => '16 avenue Reille, 75014 Paris',
            'tel' => '0600000000',
            'email' => '[email protected]',
        ),
        array(
            'name' => 'Réginald Cassius',
            'address' => '14, villa des Coteaux, 93340 Le Raincy',
            'tel' => '0600000000',
            'email' => '[email protected]',
            'commentary' => 'Door code: XXXX'
        )
    )
    'delivery_size' => 3
));
// print $delivery_quote['quote_id'] ==> 123

$validate_result = $api->post('delivery/validate', array(
    'quote_id' => $quote_id
));
// print $validate_result['order_id'] ==> 123

$follow_result = $api->get('delivery/follow', array(
    'order_id' => $order_id
));

$cancel_result = $api->post('delivery/cancel', array(
    'order_id' => $order_id
));

$check_result = $api->post('delivery/is-valid-address', array(
    'address' => '16 avenue Reille, 75014 Paris'
));
$is_valid_address = isset($check_result['is_valid_address']) && $check_result['is_valid_address'] === TRUE;
 bash
$ composer