Getting Started - Directory Structure
The framework follows a modular architecture inspired by Laravel but adapted for the WordPress ecosystem. Below is an overview of the directory structure starting from the plugin root (Ecommerce).
Project Tree
Ecommerce
├── backend # Core backend application code
│ ├── App # Application domain logic
│ │ ├── Constants # Application constants
│ │ ├── Contracts # Interfaces and Contracts
│ │ ├── DTO # Data Transfer Objects
│ │ ├── Exceptions # Custom Exceptions
│ │ ├── Hooks # WordPress Action/Filter Hooks
│ │ ├── Http # Controllers, Middlewares, Requests
│ │ ├── Models # Eloquent Models
│ │ ├── Providers # Service Providers
│ │ └── Services # Business Logic Services
│ ├── Core # Framework Core Components
│ │ ├── Console # CLI Commands
│ │ ├── Database # Database migrations, seeders, schema
│ │ ├── Managers # Core Managers (Option, Log, etc.)
│ │ └── ...
│ └── ...
├── bootstrap # Bootstrapping scripts
│ ├── app.php # Main application bootstrapper
│ └── providers.php # Provider registration
├── configs # Configuration files
├── resources # Frontend resources
│ └── views # Blade/PHP templates
├── routes # Application routes
│ └── api.php # API route definitions
├── src # Frontend source code (React/Vue/JS)
├── composer.json # PHP dependencies
└── index.php # Plugin entry point
Directory Descriptions
Backend Directory
The backend directory contains all PHP code for the application. It is strictly separated into App (your business logic) and Core (framework infrastructure).
App (backend/App)
This is where your application-specific code resides.
- Http: Contains Controllers, API Resources, and Form Requests.
- Models: Defines your database entities using the custom ORM.
- Providers: Service providers that bind your application services to the Container.
- Hooks: Classes that hook into WordPress actions and filters.
Core (backend/Core)
Contains the foundational components of the framework. You typically do not modify this directory.
- Console: Defines custom WP-CLI commands used by the framework.
- Database: Handles database connections, schema building, migrations, and seeders.
- Managers: specialized classes for managing Options, Policies, Logs, etc.
Bootstrap Directory
The bootstrap directory contains files that initialize the framework.
- app.php: Creates the
Applicationinstance. - providers.php: Returns an array of Service Providers to load.
Configs Directory
Contains configuration files for various components. These files are typically loaded by the OptionManager.
Routes Directory
Defines the HTTP entry points for your application.
- api.php: Registers REST API routes that map to Controllers.
Resources Directory
Contains non-code assets.
- views: Server-side templates (if used).
- assets: Compiled CSS/JS files.