1. Go to this page and download the library: Download apertur/sdk 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/ */
apertur / sdk example snippets
composer
use Apertur\Sdk\Apertur;
$client = new Apertur(['apiKey' => 'aptr_live_...']);
$session = $client->sessions->create(['label' => 'My shoot']);
$image = $client->upload->image($session['uuid'], '/path/to/photo.jpg');
echo $image['id'];
use Apertur\Sdk\Apertur;
// API key
$client = new Apertur(['apiKey' => 'aptr_live_...']);
// OAuth token (e.g. obtained via your auth server)
$client = new Apertur(['oauthToken' => $accessToken]);
// Custom base URL (sandbox)
$client = new Apertur([
'apiKey' => 'aptr_live_...',
'baseUrl' => 'https://sandbox.api.aptr.ca',
]);
use Apertur\Sdk\Apertur;
$client = new Apertur(['apiKey' => 'aptr_live_...']);
// Create a session
$session = $client->sessions->create([
'label' => 'Wedding reception',
'password' => 's3cr3t',
'maxImages' => 200,
]);
// Retrieve session details
$details = $client->sessions->get($session['uuid']);
// Verify a password-protected session before uploading
$result = $client->sessions->verifyPassword($session['uuid'], 's3cr3t');
// Check delivery status — snapshot
$status = $client->sessions->deliveryStatus($session['uuid']);
$overall = $status['status']; // pending|active|completed|expired
$files = $status['files'];
$changed = $status['lastChanged']; // ISO 8601
// Long-poll for the next change (server holds up to 5 min; use 6 min client timeout)
$next = $client->sessions->deliveryStatus($session['uuid'], $changed, 360.0);
use Apertur\Sdk\Apertur;
$client = new Apertur(['apiKey' => 'aptr_live_...']);
$uuid = 'session-uuid-here';
// Upload from a file path
$image = $client->upload->image($uuid, '/tmp/photo.jpg', [
'filename' => 'photo.jpg',
'mimeType' => 'image/jpeg',
'source' => 'my-app',
]);
// Upload from a stream resource
$stream = fopen('/tmp/photo.jpg', 'rb');
$image = $client->upload->image($uuid, $stream);
fclose($stream);
// Upload to a password-protected session
$image = $client->upload->image($uuid, '/tmp/photo.jpg', [
'password' => 's3cr3t',
]);
// Encrypted upload (fetch the server key first — see Encryption section)
$serverKey = $client->encryption->getServerKey();
$image = $client->upload->imageEncrypted($uuid, '/tmp/photo.jpg', $serverKey['publicKey'], [
'filename' => 'photo.jpg',
'mimeType' => 'image/jpeg',
]);