Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why "no such file or directory ... autoload.php" when accessing Laravel app?

People also ask

Where is autoload file in Laravel?

Laravel doesn't have a fixed folder to store library files starting from Laravel 5. We can create a new folder under App folder called Libraries ( App/Libraries ). Open composer. json and add the newly created folder “app/Libraries” to autoload list.

What is autoload PHP in Laravel?

Auto-Loading allows you to load class files when they are needed without explicitly loading or including them. This gives you ease in running your application by loading those files automatically which are needed every time. Laravel is built to work with Composer.

How does autoload PHP work?

The PHP Autoloader searches recursively in defined directories for class, trait and interface definitions. Without any further configuration the directory in which the requiring file resides will be used as default class path. File names don't need to obey any convention. All files are searched for class definitions.

How autoload PHP class the Composer way?

After you create the composer. json file in your project root with the above contents, you just need to run the composer dump-autoload command to create the necessary autoloader files. These will be created under the vendor directory. Finally, you need to include the require 'vendor/autoload.


Did you install Laravel's dependencies? When you unzip the framework in your work environment (i.g. htdocs) you must install the necesary dependencies with the command php composer.phar install (assuming you have installed composer and git). When that is done, you will be able to see the home page of the framework.


I had same problem on Windows(Also works for Mac).

Solution:

  1. Install composer
  2. Open cmd
  3. Navigate to your laravel application root
  4. Run composer install command in cmd

Done!


This message occurs for Laravel's dependencies. If never run composer install in your project then run this command on the terminal. Else run composer update --no-scripts. All Laravel dependencies will download.