# PHP

## Requirements

* PHP version 5.6 and later
* ImageSEO API Key, starting at [free level](https://app.imageseo.io/register)

## Installation

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

```bash
composer require imageseo/imageseo-php
```

To use the library, use Composer's [autoload](https://getcomposer.org/doc/01-basic-usage.md#autoloading):

```php
require_once __DIR__. '/vendor/autoload.php';
```

### Getting Started

#### Authentication

```php
<?php

use ImageSeo\Client\Client;

$apiKey = "YOUR_API_KEY";
$client =new Client($apiKey);
```

### Resources

Our SDK operates on the principle of resources. You must choose the resource on which you want to make an API call in order to use different methods. [See the list of our resources](/resources.md)

### Image Reports

Example : Generate an image report from URL

```php
<?php

use ImageSeo\Client\Client;

$apiKey = "YOUR_API_KEY";
$client =new Client($apiKey);

$data = [
    "url": "https://example.com/image.jpg"
];
$report = $client->getResource('ImageReports')->generateReportFromUrl($data);
```

Example : Generate an image report from file

```php
<?php

use ImageSeo\Client\Client;

$apiKey = "YOUR_API_KEY";
$client =new Client($apiKey);

$data = [
    "filePath": "/path/your/image.jpg"
];
$report = $client->getResource('ImageReports')->generateReportFromFile($data);
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.imageseo.io/api-librairies/php.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
