lucasvrm
4 years ago
346
18
Laravel

Class 'App\Http\Controllers\Spatie\Browsershot\Browsershot' not found

Posted 4 years ago by lucasvrm

Hello there!

I´ve installed a package called spatie/browsershot and I followed the steps showed here https://github.com/spatie/browsershot

But it's not working at all...

I am new to laravel, so probably this is a silly mistake... What I am doing wrong?

function inside a controller

public function create_preview()
    {
        $findhash = Link::where('hash', '=', $hash)->firstOrFail();
    $browsershot = new Spatie\Browsershot\Browsershot();
        $browsershot
            ->setURL($findhash->url)
            ->setWidth('1024')
            ->setHeight('768')
            ->save('previews/'.$findhash->url.'.jpg');

        return view('pages.teste2');

    }

composer.json

{
    "name": "laravel/laravel",
    "description": "The Laravel Framework.",
    "keywords": ["framework", "laravel"],
    "license": "MIT",
    "type": "project",
    "require": {
        "php": ">=5.5.9",
        "laravel/framework": "5.1.*",
        "guzzlehttp/guzzle": "~6.0",
        "greggilbert/recaptcha": "^2.0",
        "symfony/dom-crawler": "^2.7",
        "fabpot/goutte": "^3.1",
        "pragmarx/tracker": "^1.0",
        "geoip/geoip": "~1.14",
        "spatie/laravel-analytics": "^1.2",
        "roumen/sitemap": "^2.5",
        "ramsey/uuid": "^2.8",
        "intervention/image": "^2.3",
        "spatie/browsershot": "^1.2"
..........

Please sign in or create an account to participate in this conversation.