> ## Documentation Index
> Fetch the complete documentation index at: https://docs.screenshotmax.com/llms.txt
> Use this file to discover all available pages before exploring further.

# PHP SDK

> The ScreenshotMAX PHP SDK provides a streamlined interface for integrating ScreenshotMAX’s screenshot capabilities into your PHP applications. It simplifies tasks such as authentication, request signing, and interacting with the ScreenshotMAX API.

The SDK client stays up-to-date with the latest API capabilities.

# Getting Started

#### Install the SDK using [Composer](https://packagist.org/packages/screenshotmax/sdk/):

```bash theme={null}
composer require screenshotmax/sdk
```

# Usage Examples

Use the SDK to generate signed or unsigned URLs for screenshots, PDFs, web scraping, or animated screenshot without executing the request. Or fetch and download the result directly. You have full control over when and how each capture runs.

The SDK also supports the Scheduled Tasks API, allowing you to queue captures to run at a later time or on a recurring schedule.

### Screenshot example

```php theme={null}
<?php

use ScreenshotMax\SDK;
use ScreenshotMax\Options\ScreenshotOptions;

$sdk = new SDK("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY");

// set up options
$opts = new ScreenshotOptions();
$opts->url = "https://example.com";
$opts->format = "png";
$result = $sdk->screenshot->setOptions($opts)->fetch();

// optionally: generate signed URL
// (https://api.screenshotmax.com/v1/screenshot?url=https%3A%2F%2Fexample.com&format=png&access_key=YOUR_ACCESS_KEY&signature=370f5b161bc59eed13b76........1f778635d7fc595dbab12)
$url = $sdk->screenshot->getUrl();

// save screenshot to file
file_put_contents("screenshot.png", $result["data"]);
```

### Web scraping example

```php theme={null}
<?php

use ScreenshotMax\SDK;
use ScreenshotMax\Options\ScrapeOptions;

$sdk = new SDK("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY");

// set up options and scrape content (chaining)
$opts = new ScrapeOptions();
$opts->url = 'https://example.com';
$sdk->scrape->setOptions($opts);

$result = $sdk->scrape->fetch();
```

### PDF generation example

```php theme={null}
<?php

use ScreenshotMax\SDK;
use ScreenshotMax\Options\PDFOptions;

$sdk = new SDK("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY");

// set up options and scrape content (chaining)
$opts = new PDFOptions();
$opts->url = 'https://example.com';
$opts->pdf_paper_format = 'a4';
$result = $sdk->pdf->setOptions($opts)->fetch();
```

### Scheduled task example

```php theme={null}
<?php

use ScreenshotMax\SDK;

$sdk = new SDK("YOUR_ACCESS_KEY", "YOUR_SECRET_KEY");

// get all tasks from account
$tasks = $sdk->task->getTasks();
print_r($tasks["data"]);

/* {"tasks":[{
  "id":5678133109850112,
  "name":"Test CRON",
  "api":"screenshot",
  "query":
  "url=https%3A%2F%2Fexample.com",
  "frequency":"every_day",
  "crontab":"25 13 * * *",
  "timezone":"Etc/UTC",
  "enabled":true,
  "created":1747229104,
  "last_run":1748611516,
  "runs":18}]}
*/
```

## Next Steps

* Explore other API options like HTML to PDF, animated screenshots, or web scraping.
* Create scheduled recurring screenshots via [**Scheduled Tasks API**](/guides/start/scheduled-tasks)

## Support

For questions, issues, or feature requests, please open an issue on the [GitHub repository](https://github.com/screenshotmax/php-sdk) or contact our support team at [support@screenshotmax.com](mailto:support@screenshotmax.com).
