1

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?

The Bassman
  • 2,241
  • 5
  • 26
  • 38

2 Answers2

6

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';
Ali
  • 1,525
  • 1
  • 16
  • 27
  • 1
    Cool, this solved my problem other than the fact that instead of using `use Google\Cloud\Storage\StorageClient;`, I also had a typo problem. – The Bassman Aug 27 '18 at 16:35
0

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.