Now we will look into the application structure of Framework Laravel.

In previous post we have talked about Introduction of Laravel and How to Install Framework Laravel, now we will talk about the structure of this framework.

In previous post I have told you how to create new blog. For creating Laravel application, we simply type laravel new name-new-blog in terminal/command line then all dependencies will be loaded from cache.

When we first open the new blog project from directory, we will see the application structure – folder of Laravel that are already created.

structure

As you can see, this standard structure directory consist of quiet a few sub-directories. Most of your work will happen in /app/, here we will explain the use of basic folder that you will mostly work at. I will not explain you detail right now I know that it’s boring.

structure1

For deeper explanation you can refer to official website. As mentioned above you will spend most of your time in /app/, so we will only see a deeper look at it.

/app/ Directory

structure2

In Laravel Framework version 5.2, the structure of /app/ directory looks like picture above. Here we will take a look for simple explanation of each folder in /app/ directory.

/Console/ this directory providing an API into the ‘core’ of your application. This directory contains all of your artisan commands.

/Events/ this is place for abstract class of Events. Based on official documentation, the classes in it used to alert other parts of application. Simply explanation, Event is talking about handler you can firing and even listening of things as feedback. To know more, you can see the example of implementations here

/Exceptions/ this directory is a handler to throws wrong logic of your application. All the exception handled by /Exception/Handler.php class. This class contain two method, report and render.

/Http/ contains some directories controllers, Middleware, Request. Controllers directory is place where all controller class that contains logic of your application lies. It is acts as directing between Views and Models. Middleware directory acts as middle man between requests and responses. It is doing some jobs like filtering, verifies whether user of application is authenticating or not.

/Jobs/ this is directory where queues in your application. Jobs may be queued by your application or run synchronously within the current request lifecycle. Jobs that run synchronously during the current request are sometimes referred to as “commands” since they are an implementation of the command pattern

/Providers/ contains all of the service providers for your application. Service providers bootstrap your application by binding services in the service container, registering events, or performing any other tasks to prepare your application for incoming requests. From the first time blog Laravel created, this directory has been created some Provider classes. But you are free to add your own providers class.

That’s all for explanation of the /app/ directory. Next we will start to build something with Laravel. Check previous post Laravel Introduction and Install Framework Laravel for any references.

command3

Advertisements

One thought on “Laravel Application Structure

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s