<?php

use Screeenly\Api\ScreenshotBuilder;

class APIController extends BaseController {

    private $header;

    public function __construct()
    {
        $this->header = ['Access-Control-Allow-Origin' => '*'];
    }

    /**
     * Create a screenshot with Phantom JS
     * @return Illuminate\Http\Response
     */
    public function createFullSizeScreenshot()
    {
        $screenshot = new ScreenshotBuilder();
        $screenshot->execute();

        $result = [
            'path'       => $screenshot->assetPath ,
            'base64'     => 'data:image/jpg;base64,' . $screenshot->bas64,
            'base64_raw' => $screenshot->bas64
        ];

        $screenshot->createLog();

        return Response::json($result, 201, $this->header);
    }

}

<?php

use Screeenly\Screenshot\Screenshot;
use Screeenly\Screenshot\ScreenshotValidator;
use Screeenly\Services\CheckHostService;

class APIController extends BaseController {

    private $header;

    public function __construct()
    {
        $this->header = ['Access-Control-Allow-Origin' => '*'];
    }

    /**
     * Create Screenshot
     * @return Illuminate\Http\Response
     */
    public function createScreenshot()
    {
        $url  = Input::get('url', 'http://screeenly.com');
        $user = User::getUserByKey( Input::get('key') );

        // Validate Input
        $validator = new ScreenshotValidator();
        $validator->validate(Input::all());

        // Check if Host is available
        $checkHost = new CheckHostService();
        $checkHost->ping($url);

        // Actually Capture the Screenshot
        $screenshot = new Screenshot();
        $filename = $screenshot->generateFilename();
        $screenshot->setStoragePath($filename);
        $screenshot->setHeight(Input::get('height'));
        $screenshot->setWidth(Input::get('width', 1024));
        $screenshot->capture($url);

        $log = ApiLog::store($screenshot, $user);

        $result = [
            'path'       => $screenshot->assetPath ,
            'base64'     => 'data:image/jpg;base64,' . $screenshot->bas64,
            'base64_raw' => $screenshot->bas64
        ];

        return Response::json($result, 201, $this->header);

    }

}

Use new Classes in ApiController
Use new Classes in ApiController
