PHPackages                             niccolox/optidash-php - 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. niccolox/optidash-php

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

niccolox/optidash-php
=====================

Official PHP integration for Optidash - AI-powered image optimization and processing API. We will drastically speed-up your websites and save you money on bandwidth and storage.

031PHP

Since Aug 11Pushed 3y agoCompare

[ Source](https://github.com/niccolox/optidash-php)[ Packagist](https://packagist.org/packages/niccolox/optidash-php)[ RSS](/packages/niccolox-optidash-php/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (1)

[![Optidash](media/logotype.png)](https://optidash.ai)

Optidash is a modern, AI-powered image optimization and processing API.
We will drastically speed-up your websites and save you money on bandwidth and storage.

---

**The official PHP integration for the Optidash API.**

[![](https://camo.githubusercontent.com/a7875a9050f8b6f93e3d0246bd14fc316dde92a6e03e48ce6f2ab365a53a12bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f6f707469646173682d61692f6f707469646173682d7068703f7374796c653d666c617426636f6c6f723d73756363657373)](https://camo.githubusercontent.com/a7875a9050f8b6f93e3d0246bd14fc316dde92a6e03e48ce6f2ab365a53a12bc/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732d7261772f6f707469646173682d61692f6f707469646173682d7068703f7374796c653d666c617426636f6c6f723d73756363657373)[![](https://camo.githubusercontent.com/eb62821882518941bd477ffa5049a517159a8e811571e5f78d610f01598723c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f707469646173682d61692f6f707469646173682d7068703f7374796c653d666c617426636f6c6f723d73756363657373)](https://camo.githubusercontent.com/eb62821882518941bd477ffa5049a517159a8e811571e5f78d610f01598723c9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6f707469646173682d61692f6f707469646173682d7068703f7374796c653d666c617426636f6c6f723d73756363657373)[![](https://camo.githubusercontent.com/9769d72e387eb6c97a8f36b09d5b7ae43b6f096912a90f334fda001c21568892/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f6f7074696461736841493f6c6162656c3d466f6c6c6f772532305573267374796c653d666c617426636f6c6f723d73756363657373266c6f676f3d74776974746572)](https://camo.githubusercontent.com/9769d72e387eb6c97a8f36b09d5b7ae43b6f096912a90f334fda001c21568892/68747470733a2f2f696d672e736869656c64732e696f2f747769747465722f666f6c6c6f772f6f7074696461736841493f6c6162656c3d466f6c6c6f772532305573267374796c653d666c617426636f6c6f723d73756363657373266c6f676f3d74776974746572)

---

### Documentation

[](#documentation)

See the [Optidash API docs](https://docs.optidash.ai).

### Installation

[](#installation)

```
$ composer require optidash/optidash
```

### Quick examples

[](#quick-examples)

Optidash API enables you to provide your images for processing in two ways - by uploading them directly to the API ([Image Upload](https://docs.optidash.ai/requests/image-upload)) or by providing a publicly available image URL ([Image Fetch](https://docs.optidash.ai/requests/image-fetch)).

You may also choose your preferred [response method](https://docs.optidash.ai/introduction#choosing-response-method-and-format) on a per-request basis. By default, the Optidash API will return a [JSON response](https://docs.optidash.ai/responses/json-response-format) with rich metadata pertaining to input and output images. Alternatively, you can use [binary responses](https://docs.optidash.ai/responses/binary-responses). When enabled, the API will respond with a full binary representation of the resulting (output) image. This PHP integration exposes two convenience methods for interacting with binary responses: `toFile()` and `toBuffer()`.

#### Image upload

[](#image-upload)

Here is a quick example of uploading a local file for optimization and processing. It calls `toJSON()` at a final step and instructs the API to return a JSON response.

```
