PHP code example of partitech / llamacloud

1. Go to this page and download the library: Download partitech/llamacloud 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/ */

    

partitech / llamacloud example snippets


$client = new Partitech\LlamaCloud\Client($apiKey);
$parse = new Partitech\LlamaCloud\Parse($client);
$extensions = $parse->getSupportedFileExtensions();
print_r($extensions);

$extensions = $parse->getSupportedFileExtensions();
print_r($extensions);

$parameters = ['language' => 'en'];
$response = $parse->uploadFile('/path/to/your/file.pdf', $parameters);
print_r($response);


$usage = $parse->getUsage();
print_r($usage);


$jobDetails = $parse->getJobById('job_id');
print_r($jobDetails);


$jobDetails = $parse->getParsingJobDetails('job_id');
print_r($jobDetails);

$textResult = $parse->getJobTextResult('job_id');
print_r($textResult);


$rawTextResult = $parse->getJobRawTextResult('job_id');
print_r($rawTextResult);

$jsonResult = $parse->getJobJsonResult('job_id');
print_r($jsonResult);


$presignedUrl = $parse->generatePresignedUrl('job_id', 'filename.pdf');
print_r($presignedUrl);

$imageResult = $parse->getJobImageResult('job_id', 'image_name.jpg');
header('Content-Type: image/jpeg');
echo $imageResult->getContent();

$history = $parse->getParsingHistoryResult();
print_r($history);