team-gc / php-screensnaps
A simple PHP Library to interact with the screensnaps.io service
Requires
- php: >=7.0
Requires (Dev)
- phpunit/phpunit: ^9.5
- vlucas/phpdotenv: ^5.2
This package is auto-updated.
Last update: 2024-09-19 00:43:18 UTC
README
A simple php library to interact with the APIs for screenshot generation on screensnaps.io.
Requirements
PHP7+ CURL
Installation
You can install the package via composer:
composer require team-gc/php-screensnaps
Documentation
To get stared, you'll need an api_key
and user_id
to make requests, you can sign up for free at https://screensnaps.io.
Methods
Refer to the documentation on https://screensnaps.io/docs/intro on how to make certain calls.
Intialize Class
use TeamGC\ScreensnapsIO; $screensnapsIO = new ScreensnapsIO(["apiKey" => API_KEY_HERE, "userId" => USER_ID_HERE]);
/screenshots
Get the last 15 screenshots on your account.
$params =[ "offset" => 0, "limit" => 15 ]; try { $snaps = $screensnapsIO->screenshots($params); } catch (Exception $e) { echo $e->getMessage(); }
/screenshot
Take a screenshot of of URL or HTML depending on your params
$params =[ "url" => "https://google.com" ]; try { $snaps = $screensnapsIO->screenshot($params); } catch (Exception $e) { echo $e->getMessage(); }
/status
This is a ping to let you know the status of the service.
try { $snaps = $screensnapsIO->status(); } catch (Exception $e) { echo $e->getMessage(); }
Testing
Make sure to create a .env
file in your tests
folder like this:
USER_ID="USER_ID_HERE"
API_KEY="API_KEY_HERE"
composer test tests
Credits
License
The MIT License (MIT). Please see License File for more information.