websnap/php

Websnap PHP Client

1.5.1 2023-03-09 07:12 UTC

This package is auto-updated.

Last update: 2024-11-15 00:02:28 UTC


README

coverage report

Installation

Install with composer: composer require websnap/php

Getting started

  1. Register for free at https://www.websnap.app
  2. Create a project and copy it's token

Usage

You can either pass an url to a website or a string containing html to the client. The client will return a \Psr\Http\Message\ResponseInterface object containing the generated pdf/screenshot.

Generate an image

$client = new \Websnap\Php\Client('YOUR_TOKEN');

// Take screenshot of an url
$response = $client->screenshot('https://www.websnap.app');

// Take screenshot of passed html
$response = $client->screenshot('<h1>Hello world!</h1>');

Generate a pdf

$client = new \Websnap\Php\Client('YOUR_TOKEN');

// Capture content as PDF
$response = $client->pdf('https://www.websnap.app');

// Generate pdf of passed html
$response = $client->pdf('<h1>Hello world!</h1>');

Please see the documentation for further options.

Contact

Did you found a bug or need a certain feature? Please get in touch with us or raise an issue.