This document explains the design philosophy and decisions behind the Marwa Framework.
The framework is intentionally small. Every feature must justify its existence.
“Simplicity is the ultimate sophistication.” - Leonardo da Vinci
Implementation:
Sensible defaults with customization when needed.
Implementation:
The framework should not add unnecessary overhead.
Implementation:
Clear, consistent APIs that are pleasant to use.
Implementation:
The framework follows PSR standards where applicable:
| PSR | Purpose | Usage |
|---|---|---|
| PSR-3 | Logging | Logger interface |
| PSR-4 | Autoloading | Class loading |
| PSR-7 | HTTP | HTTP messages |
| PSR-11 | Container | Service container |
| PSR-14 | Events | Event dispatcher |
| PSR-15 | HTTP Middleware | Middleware |
| PSR-17 | HTTP Factories | Request/response |
| PSR-18 | HTTP Client | HTTP client |
We’re intentional about dependencies:
marwa-db provides:
It’s built by the same team for consistency.
// Register service
$container->addShared(Service::class, fn () => new Service());
// Get service (lazy)
$service = $container->get(Service::class);
// Constructor injection
class MyController {
public function __construct(
private UserService $users
) {}
}
// Static-like access
Router::get('/path', $handler);
// Behind the scenes
app(RouterInterface::class)->get(...);
// Dispatch event
$app->dispatch(new UserRegistered($user));
// Listen for event
$app->listen(UserRegistered::class, fn ($e) => ...);
// config/app.php
return [
'providers' => [
MyServiceProvider::class,
],
];
// config/app.php
return [
'middlewares' => [
CorsMiddleware::class,
],
];
// modules/my-module/manifest.php
return [
'providers' => [...],
'routes' => [...],
];
// Not loaded until requested
$container->addShared(HeavyService::class, fn () => new HeavyService());
// Cached after first request
$container->addShared(Config::class, $cachedConfig);
php marwa route:cache
The codebase follows:
Everyone is welcome to contribute:
See Contributing Guide for details.
The framework aims to be:
See VISION for the long-term roadmap.