PHP code example of issetbv / hatchery-api-client

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

    

issetbv / hatchery-api-client example snippets



    

    include '../src/Hatchery/Autoloader.php';
    
    $authentication = new Hatchery\Authentication\KeyPairAuthentication('consumer_key', 'private_key');
    $client  = new Hatchery\Client('api_url', $authentication);
    
    //create a new job, this class will contain all inputs and outputs
    $job = new Hatchery\Builder\Job();
    
    //create a new input, this class has to contain a valid URL and can be used to create outputs
    $input = new Hatchery\Builder\Input(new Hatchery\Builder\Url\Url('ftp://my_ftp_in_location.com/folder/input_file.mp4'));
    
    //create a new output, which links to a specific input and folder/my_stills_folder/'));
    $stills->setFilename('my_stills_frame_{{number}}');
    $stills->setAmount(new Hatchery\Builder\ValueObjects\Number(5));

    //add stills task to a specific output
    $output->addStills($stills);
    
    //add in- and outputs to job
    $job->add($input);
    $job->add($output);

    //submit job
    $response = $client->submitJob($job);
    
    //retrieve polling location (containing job id)
    $location = $response->getLocation();