Skip to content

alexschwarz89/browserstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Browserstack

Latest Stable Version Total Downloads

An easy-to-use PHP library for the Browserstack Screenshots API. Working examples included.

Install

Install via composer:

{
    "require": {
        "alexschwarz89/browserstack": "0.0.2"
    }
}

Run composer install.

Example usage

Get an array of available browsers

use Alexschwarz89\Browserstack\Screenshots\Api;
$api         = new Api('username', 'password');
$browserList = $api->getBrowsers();

Generate a screenshot

use Alexschwarz89\Browserstack\Screenshots\Api;
use Alexschwarz89\Browserstack\Screenshots\Request;
$api        = new Api('account', 'password');
$request    = Request::buildRequest('http://www.example.org', 'Windows', '8.1', 'ie', '11.0');
$response   = $api->sendRequest( $request );
$jobId      = $response->jobId;

Query information about the request

$status = $api->getJobStatus('browserstack_jobid');
if ($status->isFinished()) {
  foreach ($status->finishedScreenshots as $screenshot) {
    print $screenshot->image_url ."\n";
  }
}

Bitdeli Badge