Understanding the folder structure is essential for working with the Mini Framework. This guide explains where to place your files and what each directory is for.
project/
├── app/ # Application code
│ ├── Controllers/ # Controller classes
│ ├── Models/ # Model classes
│ ├── Views/ # View templates
│ │ ├── components/ # Reusable components
│ │ └── layouts/ # Layout templates
│ ├── Middleware/ # Middleware classes
│ └── Helpers/ # Helper functions
├── core/ # Framework core files
│ ├── App.php # Application bootstrap
│ ├── Router.php # Routing system
│ ├── Route.php # Route facade
│ ├── Controller.php # Base controller
│ ├── Model.php # Base model
│ ├── View.php # View renderer
│ ├── Request.php # Request handler
│ ├── Response.php # Response handler
│ └── Middleware.php # Base middleware
├── config/ # Configuration files
│ └── database.php # Database configuration
├── routes/ # Route definitions
│ └── web.php # Web routes
├── public/ # Public web root
│ ├── index.php # Entry point
│ └── .htaccess # Apache configuration
├── docs/ # Documentation (this site)
└── mini # CLI tool
This is where all your application code lives. It contains your controllers, models, views, and middleware.
Place all your controller classes here. Controllers handle HTTP requests and return responses.
app/Controllers/
├── HomeController.php
├── UserController.php
└── ProductController.php
Your model classes go here. Models interact with the database.
app/Models/
├── User.php
├── Product.php
└── Order.php
All view templates are stored here. Views can be organized in subdirectories.
app/Views/
├── home.php # Main views
├── user/
│ ├── profile.php
│ └── settings.php
├── components/ # Reusable components
│ ├── navbar.php
│ └── footer.php
└── layouts/ # Layout templates
└── main.php
Middleware classes for authentication, authorization, and request processing.
app/Middleware/
├── AuthMiddleware.php
├── AdminMiddleware.php
└── GuestMiddleware.php
The framework's core files. Do not modify these files unless you're extending the framework. Instead, extend the base classes in your app/ directory.
App.php - Main application class that bootstraps the framework
Router.php - Handles route registration and matching
Route.php - Route facade for static route definitions
Controller.php - Base controller class
Model.php - Base model class with PDO integration
View.php - View rendering system
Request.php - HTTP request handler
Response.php - HTTP response handler
Middleware.php - Base middleware class
Configuration files for your application. Currently includes database configuration.
config/
└── database.php # Database connection settings
Define all your application routes here. The web.php file contains your web routes.
routes/
└── web.php # All web routes defined here
This is your web server's document root. All public assets (CSS, JS, images) should be placed here.
The index.php file is the entry point for all requests.
public/
├── index.php # Application entry point
├── .htaccess # Apache URL rewriting
├── css/ # Stylesheets
├── js/ # JavaScript files
└── images/ # Image assets
Use PascalCase with "Controller" suffix: UserController.php, ProductController.php
Use PascalCase: User.php, Product.php
Use lowercase with underscores: user_profile.php, product_list.php
Use PascalCase with "Middleware" suffix: AuthMiddleware.php, AdminMiddleware.php
Now that you understand the folder structure, learn how to: