Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
vendor
LICENSE.txt
composer.json
composer.lock
dev.php
readme.md

readme.md

Ideea


Ideea.io     Getting Started     Full Documentation     Cheat Sheet


Scape PHP SDK

This is the official PHP SDK for the Scape API. This SDK is for uploading new images, retrieving existing images and creating buckets.

Installation

Require Scape with composer

$ composer require anthonybudd/scape

Getting Started

use Ideea\Scape;

Scape::boot('52372b13c197b319cf2985122cfe062a8a351141c28975b235f153079d81f8b04');

$res = Scape::upload('/tmp/upload.jpg');

echo $res->url; // "https://cdn.scape.ideea.co.uk/00595909-34d0-4de4-a4fe-402a0c2285ba.jpg"

Setup

To initialize Scape simply call the static method Scape::boot($apiKey), set your API key as the first parameter.

Scape::boot('52372b13c197b319cf298511acfe062a8a351141c289335b235f153079d3f8b04');

Methods

This is not a complete list of methods. Please refer to the full documentation for the full list of methods.

createBucket($newBucket)

To create a new bucket to store your images call the static method createBucket($newBucket)

$bucket = Scape::createBucket([
    'name' => 'my-first-bucket'
]);

getBuckets()

The getBuckets() method will return all of your group's buckets.

$buckets = Scape::getBuckets();

foreach($buckets as $bucket){
    echo $bucket->id;       // "00ce6d6a-ea2f-4840-9b5d-cd1f6ae3bc6b"
    echo $bucket->group_id; // 1
    echo $bucket->name;     // "my-first-bucket"
}

getImages($bucketID)

To get all images in a bucket

$images = Scape::getImages('00ce6d6a-ea2f-4840-9b5d-cd1f6ae3bc6b');

foreach($images as $image){
    echo $image->id;         // "4fd97b26-39db-4c08-bfb8-2115689dbb8e"
    echo $image->group_id;   // 1
    echo $image->file_size;  // 92900
    echo $image->url;        // "https://cdn.scape.ideea.co.uk/00595909-34d0-4de4-a4fe-402a0c2285ba.jpg:
}

Upload($filePath)

To upload a file to Scape, call the method upload parsing the file path as the first argument.

$image = Scape::upload('/path/to/my/image.jpg');

echo $image->url; // "https://cdn.scape.ideea.co.uk/00595909-34d0-4de4-a4fe-402a0c2285ba.jpg"

Pagination

To paginate the results of the getImages() method, parse an array with the key 'page' as the second parameter.

$bucketID = '00ce6d6a-ea2f-4840-9b5d-cd1f6ae3bc6b';

$images = Scape::getImages($bucketID, ['page' => 2]);

© Ideea x Anthony Budd

You can’t perform that action at this time.