1. Go to this page and download the library: Download filejet/filejet-php 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/ */
filejet / filejet-php example snippets
$apiKey = 'your api key';
$storageId = 'your storage id';
$signatureSecret = 'your signature secret';
$autoMode = true;
$fileJet = new FileJet\FileJet(
new FileJet\HttpClient(),
new FileJet\Config($apiKey, $storageId, $signatureSecret, $autoMode),
new FileJet\Mutation()
);
use FileJet\Messages\UploadRequest;
// get the upload instructions
$uploadInstruction = $fileJet->uploadFile(
new UploadRequest('image/jpeg', UploadRequest::PUBLIC_ACCESS, 60)
);
// you should persist this string for later usage
$fileIdentifier = $uploadInstruction->getFileIdentifier();
$uploadFormat = $uploadInstruction->getUploadFormat();
$httpClient = new FileJet\HttpClient();
$httpClient->sendRequest(
$uploadFormat->getRequestMethod(),
$uploadFormat->getUri(),
$uploadFormat->getHeaders(),
$fileContent
);
use FileJet\Messages\UploadRequest;
// get the upload instructions
$uploadInstructions = $fileJet->bulkUploadFiles(
[
new UploadRequest('image/jpeg', UploadRequest::PUBLIC_ACCESS, 60),
new UploadRequest('image/jpeg', UploadRequest::PUBLIC_ACCESS, 60),
new UploadRequest('image/jpeg', UploadRequest::PUBLIC_ACCESS, 60),
]
);
foreach ($uploadInstructions as $uploadInstruction) {
// you should persist this string for later usage
$fileIdentifier = $uploadInstruction->getFileIdentifier();
$uploadFormat = $uploadInstruction->getUploadFormat();
$httpClient = new FileJet\HttpClient();
$httpClient->sendRequest(
$uploadFormat->getRequestMethod(),
$uploadFormat->getUri(),
$uploadFormat->getHeaders(),
$fileContent
);
}
$reportUrl = $fileJet->getUrl(
new FileJet\File(
'fileIdentifierContainingOnlyCharactersAndDigits',
null,
'report.pdf'
)
);
// $reportUrl will contain 'https://yourStorageId.5gcdn.net/fileIdentifierContainingOnlyCharactersAndDigits/report.pdf'
$imageUrl = $fileJet->getUrl(
new FileJet\File(
'fileIdentifierContainingOnlyCharactersAndDigits',
'sz_100_100'
)
);
// $imageUrl will contain 'https://yourStorageId.5gcdn.net/fileIdentifierContainingOnlyCharactersAndDigits/sz_100_100'
$downloadInstruction = $fileJet->getPrivateUrl('fileIdentifierContainingOnlyCharactersAndDigits', 60);
// $url will contain the download link valid for 60 seconds
$url = $downloadInstruction->getUrl();
bash
composer
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.