1.4 Directory Structure

Before we actually start developing, we need to be familiar with our directory structure so that we dont have to keep searching for the files we want to customize.

The App Directory

The app directory contains the core code of the application. Almost all of the controllers or classes will be in this directory.

The Bootstrap Directory

The bootstrap directory contains files that bootstrap the framework and configure autoloading. This directory also houses a cache directory which contains framework generated files for performance optimization such as the route and services cache files.

The Config Directory

The config directory, as the name implies, contains all of your application’s configuration files.

The Database Directory

The database directory contains your database migration and seeds. We will be looking into this this soon

The Public Directory

The public directory contains the index.php file, which is the entry point for all requests entering the application. This directory also houses your assets such as images, JavaScript, and CSS.

The Resources Directory

The resources directory contains your views as well as your raw, un-compiled assets such as LESS, SASS, or JavaScript. This directory also houses all of your language files.

The Routes Directory

The routes directory contains all of the route definitions for your application. By default, several route files are included with Laravel:

  • The web.php file contains routes that the RouteServiceProvider places in the web middleware group, which provides session state, CSRF protection, and cookie encryption. If your application does not offer a stateless, RESTful API, all of your routes will most likely be defined in the web.php file.
  • The api.php file contains routes that the RouteServiceProvider places in the api middleware group, which provides rate limiting. These routes are intended to be stateless, so requests entering the application through these routes are intended to be authenticated via tokens and will not have access to session state.
  • The console.php file is where you may define all of your Closure based console commands. Each Closure is bound to a command instance allowing a simple approach to interacting with each command’s IO methods. Even though this file does not define HTTP routes, it defines console based entry points (routes) into your application.
  • The channels.php file is where you may register all of the event broadcasting channels that your application supports.

The Storage Directory

The storage directory contains your compiled Blade templates, file based sessions, file caches, and other files generated by the framework. This directory is segregated into app, framework, and logs directories. The app directory may be used to store any files generated by your application. The framework directory is used to store framework generated files and caches. Finally, the logs directory contains your application’s log files. The storage/app/public directory may be used to store user-generated files, such as profile avatars, that should be publicly accessible. You should create a symbolic link at public/storage which points to this directory. You may create the link using the php artisan storage:link command.

The Tests Directory

The tests directory contains your automated tests.

The Vendor Directory

The vendor directory contains Composer dependencies.

Where is the Eloquent Model’s directory?

Due to some name confusion, laravel decided to dump all these files directly under /APP. Its best we leave it there

Next Post »
1.6 Configuration
« Previous Post
1.3 Setting Up