In this post I’ll try to explain the over all directory structure of Laravel 4.2. I think the understanding of the directory structure will proved to be helpful in order to create your websites and/or web applications. Let’s begin without wasting time anymore.
The general directory or application structure of laravel 4.2 is given below:
laravel 4.2 --app --bootstrap --public --vendor composer.json composer.lock server.php
This directory is very important and we may say it the soul of our laravel application as it holds all the main and necessary components of our application which must not be public in any case. These important components are controllers, models, migrations, views, routes file, configuration files, storage and etc.
This directory contains the files needed to auto load classes, bootstrapping the application and creating/instantiating new application object.
This directory contains all the directories used as our assets such as css, js, img and fonts and files which are directly accessible by the user. That’s why we must not put any sensitive data containing files in this directory.
This directory contains all the directories and files produced by the framework vendor. This is not of our concerns until unless you want t some advanced stuffs.
laravel 4.2 --app --commands --config --controller --database --lang --models --start --storage --tests --views filters.php routes.php
This directory is used to store your custom commands for the artisan.
This directory contains the files and folders used to configure your application. You can also configure database, view, mail, sessions, local environment (in local directory) and etc.
This directory holds your controller class files.
This directory holds your migrations and seeding class files.
This directory contains language packages. You can use your own local language in the application.
This directory holds your model class files.
This directory contains a file named artisan.php to register your custom artisan commands and another file named global.php to autoload controllers and models in case you don’t want to use composer autoloading.
This directory contains folders to save logs, cache, sessions and view files temporarily created at runtime. So, you should assign write permission to this directory in order to write these file.
If you want to test your laravel application you can easily do that using laravel testing tool. For this purpose you need to create some classes which should be saved in this directory.
As its name is describing this directory holds all of your views.
This file is used to store predefined and/or custom filters.
This file is used to store our routes for our website. It provides a way to handle our sites’ routes at a single place. In this way it becomes easy to handle our routes.
laravel 4.2 --bootstrap autoload.php path.php start.php
This file, as its name explaining, contains stuffs related to the autoloading and loads of different classes.
This file contains paths to different places in our app such as App Path, Base Path, Storage Path and etc.
This file is very important as it does a lot of duty for us such as creating application instance, binding the path, detecting environment, loading application and returning the application instance.
laravel 4.2 --public --css --fonts --img --js --locales --packages .htacess index.php robots.txt
This directory holds css files.
This directory holds fonts used in our website.
This directory stores images being used in our website.
This directory holds files related to local languages other than English.
This directory holds all the assets (css, js, img, fonts etc) of your package/s if you’ve included any.
This file makes sure that whenever a route is provided to laravel , it will always start from index.html file from the public directory which enhance the security of your application.
This is the file which we may say that handles all of our routes. Whenever a route is passed to laravel index.php is the first file which is used to show other views.
laravel 4.2 --vendor
This directory, as mentioned above, holds all the files, directories, APIs, artisan commands and every thing provided by the laravel framework itself or is got from any other framework like Symfony.
That’s all from this post. I hope this will help you to understand the best PHP Framework Laravel! Feel free to comment and/or ask question via comments.