Simpe RESTful microservice with Lumen and hotrush/Webshotter package that creates pages screenshots and store it locally / s3 / rackspace (last one TBD)
0.1.1 - added timeout param
git clone git@github.com:hotrush/Webshotter-microservice.git
cd Webshotter-microservice
cp .env.example .env
composer install
note - .env file has all required config options, take a look at ACCESS_KEY that used for api authentication. Also here you can configure destination storage - local, s3 or rackspace
Ping-pong
GET /api/ping
Webshot creating
POST /api/webshot?key=YOUR_ACCESS_KEY
{
"url": "https://github.com", // required
"extension": "jpg", // optional, can be jpg, png or pdf, jpg default
"width": 1200, // optional, integer, default 1200
"height": 800, // optional, integer, default 800
"full_page": 0, // optional, 1 or 0
"filename": "test", // optional, result file name without extension, alpha_dash
"path": "2016/01/01", // optional, path to save result file
"timeout": 10 // in seconds
}
And this will return next:
{
"path": "2016/01/01/test.jpg",
"url": "http://YOUR_SITE/webshots/2016/01/01/test.jpg" // or for example for s3 https://s3-eu-west-1.amazonaws.com/your-bucket/2016/01/01/test.jpg
}
If timeout has been reached next will be return (with 500 status code):
{
"message": "Link timeout."
}
Feel free to post found bugs or make prs.
php ./vendor/bin/phpunit
The MIT License (MIT). Please see License File for more information.