PHPackages                             townsymush/ewww-client - 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. [Image &amp; Media](/categories/media)
4. /
5. townsymush/ewww-client

AbandonedArchivedLibrary[Image &amp; Media](/categories/media)

townsymush/ewww-client
======================

A client to use for connecting to the ewww API and converting images

1.0.3(7y ago)03.1kMITPHPPHP &gt;=7.1.0

Since Jan 9Pushed 7y ago1 watchersCompare

[ Source](https://github.com/townsymush/ewww-client)[ Packagist](https://packagist.org/packages/townsymush/ewww-client)[ Docs](https://github.com/townsymush/ewww-client)[ RSS](/packages/townsymush-ewww-client/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (4)Dependencies (2)Versions (5)Used By (0)

Ewww.io Client
==============

[](#ewwwio-client)

This client is a helper for using the ewww.io api for converting images to png, webp and optimising for use on the web.

To use ewww.io you require a api-key. Visit  to make an account

Please note that any functionality for ewww.io is entirely ewww.io's responsibility, this package is just a helper to use their API.

To install this package through composer

```
composer require townsymush/ewww-client

```

Usage
-----

[](#usage)

Create new instance of the converter The converter requires your api key as a string and a Guzzle Client to make the API requests

```
use TownsyMush\EwwwClient\Converter;
use GuzzleHttp\Client;

$converter = new Converter(new Client, 'your-api-key');

```

To convert/optimise and image you need to make a `Job` to process. There are two jobs `WebPJob` and `FileJob`

### WebPJob

[](#webpjob)

A `WebPJob` is used to convert an image (png, jpg) to a `webp` file.

#### Create job

[](#create-job)

If the file cannot be opened an exception will be thrown.

```
use GuzzleHttp\Client;
use TownsyMush\EwwwClient\Converter;
use TownsyMush\EwwwClient\WebPJob;

$converter = new Converter(new Client, 'your-api-key');

// Create new instance with filename set as 'filename'
$job = new WebPJob('path-to-file', 'filename');

```

#### Set height and width (optional)

[](#set-height-and-width-optional)

If you want to change height and width of image. You must set both on the job. The methods accept an integer which will set the image sizes in pixels

```
$job->setWidth(100);
$job->setHeight(100);

```

#### Set image quality (optional)

[](#set-image-quality-optional)

If you want to change the quality of the image set the quality with the following method. note the default is set at 82

```
$job->setQuality(82);

```

### FileJob

[](#filejob)

This job is used to optimise and image or convert a `jpg` or `gif` to `png`.

#### Create job

[](#create-job-1)

If the file cannot be opened an exception will be thrown.

```
use GuzzleHttp\Client;
use TownsyMush\EwwwClient\Converter;
use TownsyMush\EwwwClient\FileJob;

$converter = new Converter(new Client, 'your-api-key');

// Create new instance with filename set as 'filename'
$job = new FileJob('path-to-file', 'filename');

```

#### Set image quality (optional)

[](#set-image-quality-optional-1)

If you want to change the quality of the image set the quality with the following method. note the default is set at 82 and this is only in effect is `convert` is set to `true` when processing `PNG` images.

```
$job->setQuality(82);

```

#### Preserve metadata (optional)

[](#preserve-metadata-optional)

To preserve metadata in the image file set the `metadata` to `true`. Note: Default is `false`

```
$job->setMetadata(true);

```

#### Lossy compression (optional) (Recommended)

[](#lossy-compression-optional-recommended)

To set lossy compression for higher compression with minimal quality loss Note: Default is `false`

```
$job->setLossy(true);

```

#### Convert file (optional)

[](#convert-file-optional)

To convert the file type set this to `true`. It enables the conversion mode on the `ewww.io API` request (`JPG` to `PNG`, `PNG` to `JPG` or `GIF` to `PNG`)

```
$job->setConvert(true);

```

### Processing a job example

[](#processing-a-job-example)

Once a job has been created, the next step is to process that job with the converter.

```
use GuzzleHttp\Client;
use TownsyMush\EwwwClient\Converter;
use TownsyMush\EwwwClient\FileJob;

$converter = new Converter(new Client, 'your-api-key');

// Create new instance with filename set as 'filename'
$job = new FileJob('path-to-file', 'filename');

$response = $converter->process($job);

// The response object will contain a file response which you can write directly to a resource e.g.
file_put_contents($response, $response)

```

Worth noting
------------

[](#worth-noting)

Unfortunately the ewww.io API does not return error status codes which could make the client throw an exception. If the api request failed you will need to inspect the response for the error message.

We are assuming that you will have validated your image before sending it through the ewww.io api. This package does not validate the image types being processed.

Tests
-----

[](#tests)

We have written some tests as part of this package which you can run by running `./vendor/bin/phpunit` while in the project directory. You will need o add your `api-key` to the tests and remember this will use some of your pre-paid credits on your ewww.io account.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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 ~0 days

Total

4

Last Release

2681d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6e1a1e9fc9272e659d973ebc4bca6c30363185f86ad4831d484140176b6fb705?d=identicon)[townsymush](/maintainers/townsymush)

---

Tags

Webpewwwewww.io

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/townsymush-ewww-client/health.svg)

```
[![Health](https://phpackages.com/badges/townsymush-ewww-client/health.svg)](https://phpackages.com/packages/townsymush-ewww-client)
```

###  Alternatives

[rosell-dk/webp-convert

Convert JPEG &amp; PNG to WebP with PHP

6038.1M54](/packages/rosell-dk-webp-convert)[choowx/rasterize-svg

A PHP library for converting SVG to JPEG, PNG, and WEBP

2261.7k](/packages/choowx-rasterize-svg)[rosell-dk/webp-convert-cloud-service

Cloud service for converting JPEG &amp; PNG to WebP

545.6k3](/packages/rosell-dk-webp-convert-cloud-service)[codeblog/conveter-php-webp

Easy WebP conversion library for PHP

124.1k1](/packages/codeblog-conveter-php-webp)[somehow-digital/typo3-media-processing

Media Processing

101.1k](/packages/somehow-digital-typo3-media-processing)

PHPackages © 2026

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