Directory Structure
Introduction
The default Lacelium application structure is designed to provide a solid starting point for both small and large applications. You are free to organize your application however you like; however, following the framework's conventions keeps your code intuitive and easy to maintain.
The Root Directory
A fresh Lacelium installation contains the following root directories and files:
├── app/
│ ├── Console/
│ ├── Helpers/
│ ├── Http/
│ │ ├── Controllers/
│ │ └── Middleware/
│ ├── Models/
│ └── Views/
├── config/
│ ├── app.php
│ ├── cache.php
│ ├── database.php
│ ├── filesystems.php
│ └── routes.php
├── database/
│ ├── migrations/
│ └── seeders/
├── public/
│ ├── assets/
│ ├── uploads/
│ └── index.php
├── resources/
│ └── lang/
├── storage/
│ ├── cache/
│ └── logs/
├── vendor/
├── composer.json
├── console
└── .env
The App Directory
The app directory contains the core business logic of your application. Almost all of the classes in your application will be located in this directory.
The Http Directory
The app/Http directory contains your controllers, middleware, and form requests. Almost all of the logic to handle requests entering your application will be placed here.
Controllers/: Handle incoming HTTP requests, coordinate business logic, and return responses or Twig views.Middleware/: Filter HTTP requests entering your application (e.g. CSRF verification, session authentication).
The Models Directory
The app/Models directory contains all of your Eloquent Active Record model classes. Eloquent allows you to query and insert data in your tables using object-oriented syntax.
The Views Directory
The app/Views directory contains all of your application's Twig templates. Views are organized into subdirectories such as shared/layouts/, docs/, maintenance/, and domain-specific feature views.
The Helpers Directory
The app/Helpers directory contains custom application-level utility classes and static convenience helpers.
The Config Directory
The config directory, as the name implies, contains all of your application's configuration files. It's a great idea to read through all of these files and become familiar with all of the options available to you.
The Database Directory
The database directory contains your database migrations and seeders:
migrations/: Version-controlled database schema definitions.seeders/: Sample and test data generation scripts.
The Public Directory
The public directory contains the index.php file, which is the entry point for all requests entering your application and configures autoloading. This directory also houses your assets such as images, compiled JavaScript, and CSS.
Your web server should always be configured to point its document root directly to this directory, preventing direct access to sensitive project files.
The Storage Directory
The storage directory contains your compiled Twig templates, file-based sessions, file caches, and other files generated by the framework:
app/: Private file storage used by your application.cache/: File-based cache storage.logs/: Application error logs generated via Monolog.
Next Steps
- Learn how to handle templates in Frontend & Assets.
- Review the request lifecycle in Core Concepts.
- Set up routing rules in Routing.