Module Development
Modules are a way to add new functionality to Flute CMS without changing the core. Each module works independently and can be easily installed, updated, or removed.
What a Module Can Do
- Add pages — new site sections (blog, forum, shop)
- Extend functions — widgets, payment systems, integrations
- Work with data — own tables in the database
- Integrate with admin panel — settings, content management
- Interact with other modules — via events and API
Modules are installed in the app/Modules/ folder. Each module is a separate folder with its own code.
Quick Start
A minimal module consists of two files:
app/Modules/Hello/
├── module.json ← Module description
└── Providers/
└── HelloProvider.php ← Entry point1. Create module.json
{
"name": "Hello",
"version": "1.0.0",
"description": "My first module",
"providers": [
"Flute\\Modules\\Hello\\Providers\\HelloProvider"
]
}2. Create Provider
<?php
namespace Flute\Modules\Hello\Providers;
use Flute\Core\Support\ModuleServiceProvider;
class HelloProvider extends ModuleServiceProvider
{
protected ?string $moduleName = 'Hello';
public function boot(\DI\Container $container): void
{
// Automatically loads all module resources
$this->bootstrapModule();
}
}3. Activate Module
Go to Admin Panel → Modules → Find your module → Activate.
Done! The module is working. Now you can add controllers, templates, and other features.
Typical Module Structure
app/Modules/Blog/
├── module.json # Description and dependencies
├── Providers/
│ └── BlogProvider.php # Module provider
├── Http/Controllers/
│ └── ArticleController.php # Controllers
├── database/Entities/
│ └── Article.php # DB Entities
├── Resources/
│ ├── config/
│ │ └── blog.php # Settings
│ ├── lang/
│ │ ├── ru/messages.php # Translations (Russian)
│ │ └── en/messages.php # Translations (English)
│ └── views/
│ └── pages/
│ └── index.blade.php # Templates
├── Components/
│ └── ArticleCard.php # Yoyo components
├── Widgets/
│ └── RecentArticles.php # Widgets
└── Services/
└── ArticleService.php # Business logicDocumentation Sections
Basics
Advanced Topics
Reference & Tools
Examples & Practices
What’s Next
Learn Module Structure
Understand what each folder is responsible for and how Flute loads resources.
Create a Controller
Learn how to handle HTTP requests and work with data.
Add Views
Create a user interface with Blade and components.
Configure Localization
Add support for multiple languages.
Publish Module
Share your module with the Flute CMS community.