PHPackages                             zara-4/php-sdk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. zara-4/php-sdk

ActiveLibrary

zara-4/php-sdk
==============

Helper classes used to interact with the Zara 4 API.

v1.2.3.3(8y ago)2969MITPHPPHP &gt;=5.3.0

Since Jan 14Pushed 8y ago1 watchersCompare

[ Source](https://github.com/zara-4/php-sdk)[ Packagist](https://packagist.org/packages/zara-4/php-sdk)[ Docs](https://github.com/zara-4/php-sdk)[ RSS](/packages/zara-4-php-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (18)Used By (0)

Zara 4 PHP SDK
==============

[](#zara-4-php-sdk)

PHP SDK for the Zara 4 [Image Compression](https://zara4.com) API. For more information see Zara 4 API [documentation](https://zara4.com/docs/getting-started/welcome)

Installation
------------

[](#installation)

### Composer

[](#composer)

You can install the SDK via [Composer](http://getcomposer.org/). Run the following command:

```
composer require zara-4/php-sdk
```

To use the SDK, use Composer's [autoload](https://getcomposer.org/doc/00-intro.md#autoloading):

```
require_once('vendor/autoload.php');
```

Authentication
--------------

[](#authentication)

All authentication with the Zara 4 API is handled by the PHP SDK. You simply need to provide your API\_CLIENT\_ID and API\_CLIENT\_SECRET when creating an API Client.

The Zara 4 API uses OAuth authentication, using access tokens to grant access. Access tokens are automatically generated and transparently refreshed by the PHP SDK.

Example API client setup

```
use Zara4\API\Client;

$apiClient = new Client(API_CLIENT_ID, API_CLIENT_SECRET);
```

To get your API credentials [click here](https://zara4.com/account/api-clients)

Image Processing
----------------

[](#image-processing)

The Zara 4 PHP SDK offers extensive support for image processing, making integrating Zara 4 into your PHP application very simple.

All authentication and communication with the Zara 4 API is automatically handled, meaning you can compress both remote and local images in just 4 lines of code.

### Local Image

[](#local-image)

To process images on your local machine you should use a LocalImageRequest. This uploads the image from your machine to Zara 4 for processing.

Example usage

```
use Zara4\API\Client;
use Zara4\API\ImageProcessing\LocalImageRequest;
use Zara4\API\ImageProcessing\ProcessedImage;

$apiClient = new Client(API_CLIENT_ID, API_CLIENT_SECRET);
$originalImage = new LocalImageRequest("/path/to/original-image.jpg");
$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
```

### Remote Image

[](#remote-image)

To process images from a remote location (such as a website url), you should use a RemoteImageRequest. This downloads the image from the remote location to Zara 4 for processing. The image url given must be publicly accessible.

Example usage

```
use Zara4\API\Client;
use Zara4\API\ImageProcessing\RemoteImageRequest;
use Zara4\API\ImageProcessing\ProcessedImage;

$apiClient = new Client(API_CLIENT_ID, API_CLIENT_SECRET);
$originalImage = new RemoteImageRequest("https://example.com/original-image.jpg");
$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
```

### Cloud Image

[](#cloud-image)

To process images from a cloud location (such as a Google Drive or Dropbox), you should use a CloudImageRequest. This downloads the image from the cloud location to Zara 4 for processing.

Example usage

```
use Zara4\API\Client;
use Zara4\API\ImageProcessing\CloudImageRequest;
use Zara4\API\ImageProcessing\ProcessedImage;

$apiClient = new Client(API_CLIENT_ID, API_CLIENT_SECRET);
$cloudDriveId = '905aaac0-06bb-11e7-83da-0b30de6ae4a2'; // Replace with your cloud drive id
$cloudFileId  = '0B_x2cioi5h8IX1NwYkNDcE96Tlk'; // Replace with the id of the file you wish to compress
$originalImage = new CloudImageRequest($cloudDriveId, $cloudFileId);
$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
```

### Options

[](#options)

You can customise how your images are processed with Zara 4 by altering your request options.

Example usage

```
use Zara4\API\Client;
use Zara4\API\ImageProcessing\LocalImageRequest;

$apiClient = new Client(API_CLIENT_ID, API_CLIENT_SECRET);
$originalImage = new LocalImageRequest("/path/to/original-image.jpg");

// Change request options
$originalImage->optimisationMode = OptimisationMode::HIGHEST;
$originalImage->outputFormat = OutputFormat::MATCH;
$originalImage->colourEnhancement = ColourEnhancement::IMPROVE_COLOUR;
$originalImage->resizeMode = ResizeMode::NONE;

$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
```

Uploading Compressed Images To Cloud Storage
--------------------------------------------

[](#uploading-compressed-images-to-cloud-storage)

As well as downloading compressed images, you can also request from them to be uploaded to one of your [Cloud Storage](https://zara4.com/account/cloud-storage) locations.

```
$request = new \Zara4\API\ImageProcessing\LocalImageRequest('test-images/001.jpg');

// --- --- --- ---

// The id of the cloud storage drive to upload to (Replace with your cloud drive id)
// You can manage your Cloud Storage from https://zara4.com/account/cloud-storage
$destinationDriveId = '905aaac0-06bb-11e7-83da-0b30de6ae4a2';

// The name the uploaded file should be given on you Cloud Storage
$destinationFileName = 'YOUR FILE NAME';

// You can also specify the folder the compressed image should be uploaded to
// If you do not wish to specify a parent folder, set $destinationParentId = null
$destinationParentId = 'xxxxxxxxxxxxxxxxxxx';

$request->uploadToCloud($destinationDriveId, $destinationFileName, $destinationParentId);

// --- --- --- ---

$response = $this->client->processImage($request);
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~43 days

Recently: every ~50 days

Total

17

Last Release

3074d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2f0d77a0a32bfc7cdd96d2937da5c554f892e7f3f0f1b863c04526c386086ff1?d=identicon)[CBS Industries](/maintainers/CBS%20Industries)

---

Top Contributors

[![colin-stannard](https://avatars.githubusercontent.com/u/3418449?v=4)](https://github.com/colin-stannard "colin-stannard (65 commits)")

---

Tags

Zara 4Image Optimisation

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/zara-4-php-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/zara-4-php-sdk/health.svg)](https://phpackages.com/packages/zara-4-php-sdk)
```

###  Alternatives

[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k20](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
