Skip to content
This repository was archived by the owner on Aug 27, 2022. It is now read-only.

shield-wall/transloadit-php-idea

 
 

Repository files navigation

Transloadit PHP SDK

Test Actions Status Code quality coverage Packagist PHP Version Support License

A PHP Integration for Transloadit's file uploading and encoding service

Intro

Transloadit is a service that helps you handle file uploads, resize, crop and watermark your images, make GIFs, transcode your videos, extract thumbnails, generate audio waveforms, and so much more. In short, Transloadit is the Swiss Army Knife for your files.

This is a PHP SDK to make it easy to talk to the Transloadit REST API.

Getting Started

Installation

composer require transloadit/php-sdk

Documentation

Full documentation can be found over on transloadit.github.io/php-sdk

Basic Usage

require_once 'vendor/autoload.php';

use Transloadit\Model\Auth;
use Transloadit\Factory\AssemblyResourceServiceFactory;
use Transloadit\Model\Step;
use Transloadit\Model\Parameter;
use Transloadit\Model\Resource\Assembly;

//This Auth you will use to all resources.
$auth = new Auth('your_key', 'your_secret');

//create a resource instance, this service will be used to consume assembly resource
$assemblyResource = AssemblyResourceServiceFactory::create($auth);

//create a step
$step1 = new Step('resize', [
    'robot' => '/image/resize',
    'width' => 200,
    'height' => 100,
]);

$parameter = new Parameter([$step1]);
// you can add an step this way too $parameter->addStep($step1)

#create a assembly instance
$assembly = new Assembly($parameter);
$assembly->addFilePath('/PATH/TO/FILE.jpg');

#creating a assembly in transloadit api
$assembly = $assemblyResource->create($assembly);

/**
 The $assembly variable will return an assembly object.
 
 class Transloadit\Model\Resource\Assembly#34 (6) {
     private $id =>
     string(32) "your_id"
     private $url =>
     string(78) "http://api2.deoria.transloadit.com/assemblies/your_id"
     private $sslUrl =>
     string(79) "https://api2-deoria.transloadit.com/assemblies/your_id"
     private $status =>
     string(18) "ASSEMBLY_COMPLETED"
     private $signature =>
     ...
 */

About

Transloadit's official PHP SDK

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • PHP 95.6%
  • Makefile 2.3%
  • Shell 2.1%