Download the PHP package filejet/filejet-php without Composer

On this page you can find all versions of the php package filejet/filejet-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package filejet-php

FileJet PHP library

Provides PHP wrapper for communication with FileJet API.

For integration with Symfony project visit filejet/filejet-bundle repository.

Installation

You can install FileJet PHP library easily via Composer:

Usage

You need Storage ID and API key to be able to communicate with FileJet API. You can find those at filejet.io after registration.

FileJet PHP library internally calls FileJet API via HttpClient. We have used for our implementation HTTPlug project so you can use any HTTP client you want. You can easily use it with php-http/guzzle6-adapter by installing it via Composer (see below) or you can follow HTTPlug tutorial for registering any HTTP client you choose.

Setup your service:

The FileJet\FileJet class provides few public methods which can be used for generating URL for public files (supports on the fly mutations for images), fetching signed URL for private files, generating signed instructions for uploading the file to FileJet and deleting the files from FileJet by providing the file identifier.

uploadFile(UploadRequest $request): UploadInstruction

This method generates the instructions for uploading the file to FileJet. FileJet\UploadInstructions contain file identifier for the file which will be uploaded - you should store this information for further usage (eg. for generating the links or deleting the files). The object also contains upload format object with signed URL for uploading the file, HTTP method which should be used and suitable headers which need to be used within the upload request.

You can either upload your file via some PHP HTTP client (which you already have set up because of FileJet API communication) or as recommended you can upload the file asynchronously via JavaScript. You will use URL, headers and HTTP method from UploadFormat object and body will contain file you want to upload.

Within FileJet\Messages\UploadRequest you need to specify mime type of file you want to upload, the accessibility of the file (public or private) eg. if you want the file to be publicly accessible via FileJet CDN (suitable for images) or you want to upload private file with sensitive information (suitable for documents) which will be accessible only for users with the correct Storage ID and API key. The last parameter is optional and it tells FIleJet for how long should the upload link be valid. Default value is 60 seconds.

For better performance we recommend upload files via JavaScript by fetching the upload format from FileJet API via your backend and provide these information to the frontend. Then you can simply use fetch.

bulkUploadFiles(UploadRequest[] $requests): UploadInstruction[]

This method is useful when you want tu upload multiple files. It works exact the same like uploadFile() but is more efficient than calling multiple times uploadFile().

The result UploadInstruction[] is ordered in the same order as the input UploadRequest[]. Default php array keys are used.

getUrl(FileInterface $file): string

When you upload file with public accessibility eg. you will use FileJet\Messages\UploadRequest::PUBLIC_ACCESS while fetching upload format you can access your files via FileJet CDN. This method will generate the publicly accessible link for your files based on your configuration.

Method accepts only argument the object which describes your file. You can use this method with FileJet\File object which implements FileJet\FileInterface. The object contains file identifier provided by uploadFile() method. If you are trying to get link for image you can optionally provide mutation string (see documentation). For SEO purposes you can provide the optional third argument which will append the file URL with your custom name.

getPrivateUrl(string $fileId, int $expires): DownloadInstruction

After uploading file to private storage you can retrieve download link by this method. You just need to provide file identifier as first argument. The second argument specifies the number of seconds when the link is valid eg. its expiration time.

getExternalUrl(string $url, string $mutation)

You don't need to upload files through FileJet service in order to use all of its functionality, You can use all mutations with your own images.

Simply use this method for your publicly accessible images with use of FileJet mutations. In order for this method to work you will need either add the domain from which you are serving your images to the whitelist or you can provide signatureSecret to your configuration.

You can manage the whitelist and your signatureSecret at https://app.filejet.io

deleteFile(string $fileId): void

This method will delete file from FileJet. The only argument is file identifier obtained from uploadFile() method.

Auto optimization mode

You can use our intelligent auto optimization mode by simply activate it globally by setting a third argument of FileJet\Config to true. This will append every public URL with auto mutation which is responsible for providing most optimized version of your image to your clients.

If you don't want to use auto mode globally you can append at any time to your images by simply providing auto mutation string.

If you are using auto optimization mode globally and you for any reason want to disable it for specific images, you can disable it per image by providing auto=false mutation.


All versions of filejet-php with dependencies

PHP Build Version
Package Version
Requires php Version ^7.1|^8.0
psr/http-message Version ^1.0
php-http/client-implementation Version ^1.0
php-http/httplug Version ^1.0|^2.0
php-http/message-factory Version ^1.0
php-http/discovery Version ^1.0
aws/aws-sdk-php Version ^3.238.2
ext-json Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package filejet/filejet-php contains the following files

Loading the files please wait ....