The Bassman
The Bassman

Reputation: 2361

LARAVEL: main(): Failed opening required 'vendor\autoload.php'

I followed this documentation and I keep getting that main(): Failed opening required 'vendor\autoload.php' error and I ran composer install but still get the same error. I'm using Laravel and I'm calling this from a Controller..

namespace App\Http\Controllers;

require 'vendor/autoload.php';
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Google\Cloud\Speech\SpeechClient;
use Google\Cloud\Speech\StorageClient;
use App\Model\FilesModel;
use Illuminate\Support\Facades\DB;

class FilesController extends Controller
{

    private $project_id;
    private $speech;
    private $options;
    private $storage;

    public function __construct()
    {
        $storage = new StorageClient([
            'keyFile' => json_decode(file_get_contents(public_path() . '/key.json'), true)
        ]);
    ....

How do I bypass this issue?

Upvotes: 1

Views: 6870

Answers (2)

I solved deleting the "require '../vendor/autoload.php';" sentence from Controller and works in bouth environments (local and server). I am working with an Openpay integration.

That was hard for me, because i was trying to solve editing the routes or updating composer and stuff like that.

Upvotes: 0

Ali
Ali

Reputation: 1795

first of all no need to do that! because it's included in all pages...
if you insist doing this I think the problem is the address of autoload file which have to be:

require '../vendor/autoload.php';

Upvotes: 6

Related Questions