Getting Started
Backend
InstallationStructureStructurePackageRoutingControllerEloquentEventContentAppendixCategoryCommandsDataGridEvent ListFormsMailerStorageUserable
Frontend
ExampleLanguage

Structure

The MetaFox directory structure extends the Laravel framework directory structure. Please read laravel directory structure for more details.

app/ : Contains the core code of laravel framework
bootstrap/ : Laravel default, don't change
app.php :
cache/ : Contains framework generated files for performance optimization such as the route and services cache files.
config/ : Contains root of your application's configuration files.
database/ : Contains root database migrations, model factories, and seeds.
packages/ : All MetaFox packages
metafox/ : Contains MetaFox core packages
platform/ : Contains MetaFox framework code.
public/ : Laravel defaults
.htaccess
robot.txt
index.php : Entry point for all requests
resources/ : Laravel default
routes/ : Laravel default
storage/ : Laravel default
logs/ : Contains your file based logs files
app/
public/ : Contains users uploaded files
tests/ : Contains root automated tests
vendor/ : Contains your Composer dependencies.

Now, we'll look into directories deeper

app Directory

The app directory contains the core code of Laravel framework. You should not change this source code to keep your application is upgradable.

bootstrap Directory

The bootstrap directory contains the app.php file which bootstraps the framework. This directory also has a cache directory which contains generated files for performance optimization such as the route and services cache files. You don't need to modify any files within this directory.

config Directory

The config directory contains root of your application's configuration files. It's a great idea to read through all of configuration files and familiarize yourself with all of the available options.

database Directory

The database directory contains root database migrations, model factories, and seeds. Also, you can use this directory to hold an SQLite database.

public Directory

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

resources Directory

The resources directory contains your views as well as your raw, un-compiled assets such as CSS or JavaScript.

routes Directory

The routes directory contains root of the route definitions for your application. By default, several route files are included with Laravel, such as: web.php, api.php, console.php, and channels.php.

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 support stateless RESTful API then it is likely that 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. These routes are intended to be stateless, so requests entering the application through these routes need 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 bounded to a command instance allowing a simple approach to interact with each command's IO methods. Even though this file does not define HTTP routes, it defines console based entrypoints (routes) into your application.

The channels.php file is where you may register all of the event broadcasting channels that your application supports.

storage Directory

The /storage directory contains your logs, 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 Artisan command.

tests Directory

The /tests directory contains root automated tests. Example PHPUnit unit tests and feature tests are provided out of the box. Each test class should be suffixed with Test. You may run your tests using the phpunit or php vendor/bin/phpunit commands. Or, if you would like a more detailed and beautiful representation of your test results, you may run your tests using the php artisan test Artisan command.

vendor Directory

The vendor directory contains your Composer dependencies.

Next Chapter

Top