alina
alina

Reputation: 41

Why I can't find vendor/autoload.php for Google Calendar API?

I am following all steps to run a PHP Google Calendar Api. I followed this link: https://developers.google.com/google-apps/calendar/quickstart/php . In step 4 it asks to run quickstart.php, but as after running the file, it displayed me this error :

Warning: require(vendor/autoload.php): failed to open stream: No such file or directory in C:\xampp\htdocs\Calendar\google-api-php-client-master\quickstart.php on line 2

Fatal error: require(): Failed opening required 'vendor/autoload.php' (include_path='.;C:\xampp\php\PEAR') in C:\xampp\htdocs\Calendar\google-api-php-client-master\quickstart.php on line 2

Upvotes: 4

Views: 6606

Answers (3)

Fasanya Abiola
Fasanya Abiola

Reputation: 1

This fixed it for me make sure you have composer installed then try the below command in your terminal

  composer update

Upvotes: 0

Eduardo H. Bortolotti
Eduardo H. Bortolotti

Reputation: 11

I solve this issue using the followed command:

composer dump-autoload -o

I would execute it inside of the application folder.

Example:

c:\<< your_app_folder >>\composer dump-autoload -o.

After that, you will see the "vendor" folder. The autoload.php file will inside.

For more information, access the link:
http://phpenthusiast.com/blog/how-to-autoload-with-composer

Upvotes: 1

Michael Cordingley
Michael Cordingley

Reputation: 1525

Here's a check-list for you to go down with Composer and vendor/autoload.php:

  • Does your composer.json file exist in the root of your project? (Note: This may be up a level from your document root for your web server.)
  • Does the vendor folder exist in the same folder as your composer.json?
  • Are you using the correct relative path to find your vendor/autoload.php file?

If composer.json isn't in your project root, move it there. It's where it belongs and things will continue to go wrong for you until it's there.

The vendor folder and its autoload.php file are both automatically created when you run php composer.phar install or php composer.phar update. If they're missing, you need to run php composer.phar install.

Once you've verified that vendor/autoload.php exists and is in the correct location, make sure that you have a good relative reference to that file with your require statement.

Upvotes: 2

Related Questions