composer require skylab/studio
Ensure that autoload is configured properly in composer.json
{
"autoload": {
"psr-4": {
"Skylab\\Studio\\": "src/"
}
}
}
require './vendor/autoload.php';
use Skylab\Studio\SkylabStudio;
$api = new SkylabStudio('your-api-key');
// CREATE PROFILE
$profilePayload = [
'name' => 'profile name',
'enable_crop' => false,
'enable_retouch' => true
];
$profile = $api->createProfile($profilePayload);
// CREATE JOB
$jobPayload = [
'name' => 'job name',
'profile_id' => $profile['id']
];
$job = $api->createJob($jobPayload);
// UPLOAD JOB PHOTO(S)
$filePath = '/path/to/photo';
$api->uploadJobPhoto($filePath, $job['id']);
// QUEUE JOB
$payload = [ 'callback_url' => 'YOUR_CALLBACK_ENDPOINT' ];
$api->queueJob($job['id'], $payload);
// NOTE: Once the job is queued, it will transition to processed and then completed
// We will send a response to the specified callback_url with the output photo download urls
List the last 30 jobs.
$api->listJobs();
$payload = [
'name' => 'your unique job name',
'profile_id' => 123
]
$api->createJob($payload);
For all payload options, consult the API documentation.
$api->getJob($jobId);
$api->getJobByName($name);
$payload = [
'name' => 'your updated job name',
'profile_id' => 123
]
$api->updateJob($jobId, $payload);
For all payload options, consult the API documentation.
$payload = [ 'callback_url' => 'YOUR_CALLBACK_ENDPOINT' ]
$api->queueJob($jobId, $payload);
$api->getJobsInFront($jobId);
$api->deleteJob($jobId);
$api->cancelJob($jobId);
$api->listProfiles();
$api->createProfile([
'name' => 'My Profile'
]);
For all payload options, consult the API documentation.
$api->getProfile($profileId);
$payload = [
'name' => 'My updated profile name',
];
$api->updateProfile($profileId, $payload);
For all payload options, consult the API documentation.
This function handles validating a photo, creating a photo object and uploading it to your job/profile's s3 bucket. If the bucket upload process fails, it retries 3 times and if failures persist, the photo object is deleted.
$api->uploadJobPhoto($photoPath, $jobId);
Returns: { photo: { photoObject }, uploadResponse: bucketUploadResponseStatus }
If upload fails, the photo object is deleted for you. If upload succeeds and you later decide you no longer want to include that image, use delete_photo to remove it.
$api->getPhoto($photoId);
$api->deletePhoto($photoId);
- Enable debug mode
- Capture the response data and check your logs — often this will have the exact error
Debug mode prints out the underlying request information as well as the data payload that gets sent to Skylab.
You will most likely find this information in your logs. To enable it, simply put true
as a parameter
when instantiating the API object.
$api = new SkylabStudio("your-api-key", true);
SkylabTech's API typically sends responses back in these ranges:
- 2xx – Successful Request
- 4xx – Failed Request (Client error)
- 5xx – Failed Request (Server error)
If you're receiving an error in the 400 response range follow these steps:
- Double check the data and ID's getting passed to Skylab
- Ensure your API key is correct
- Log and check the body of the response