designbymalina / dbmframework
DBM Framework
Requires
- php: ^8.1
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
- psr/http-message: ^2.0
- psr/http-server-handler: ^1.0
- psr/http-server-middleware: ^1.0
- psr/log: ^1.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.59
- phpstan/phpstan: ^1.10
- phpunit/phpunit: ^10.0
README
DBM Framework is a lightweight PHP application engine designed for developers who want full architectural control without the complexity of heavyweight frameworks.
A framework focused on performance, simplicity, and complete control over the application architecture.
Designed for high-performance modular PHP applications.
Fast. Flexible. PSR-compliant.
The DBM v6 framework was created as a response to the excessive complexity in modern PHP frameworks.
It does not impose a complete application structure - it provides ready-made components that can be used or replaced.
Performance
The framework was designed with minimal runtime overhead in mind:
- ~1.9 ms response time (with server caching enabled)
- ~3–4 ms without caching
- ~5 ms with database and templating
Measured on an external server in a development environment.
Results depend on configuration and load.
"Laravel and Symfony are powerful and extensive. DBM focuses on speed, lightweight architecture, and full control."
Why DBM Framework?
Unlike large frameworks:
- it doesn't dictate the application's structure
- it doesn't hide logic behind "magic"
- it doesn't introduce unnecessary layers
It gives you full control over your code and performance.
DBM is a framework that doesn't fight the developer - it lets them work the way they want.
Features
The framework provides the minimal set of tools needed to build applications—without unnecessary layers and overhead.
- Modular architecture (PSR-4 compliant)
- Lightweight middleware pipeline (PSR-style request flow)
- Flexible routing system
- Lightweight Dependency Injection container (no reflective magic)
- Event-driven extensibility
- CLI support via the application layer
- Framework core only (no CMS, no platform, no UI layer)
- Minimal runtime overhead (focused on high performance)
No hidden mechanisms or automatic configuration – everything works transparently and predictably.
Performance First Architecture
DbM Framework was designed with one primary goal: maximum performance with minimal overhead.
From routing and dependency loading to templating and API responses - every layer is optimized for speed and flexibility.
⭐ If you like the project, leave a star on GitHub.
Local benchmark tests showed significantly lower runtime overhead compared to many popular PHP frameworks.
Projects based on DBM Framework
- DBM CMS
- DBM Platform
- API systems
- Modular web applications
Built-in components
The framework includes a set of lightweight infrastructure components needed to build web applications.
HTTP and Application
- HTTP routing
- Middleware (request/response pipeline)
- Dependency Injection container
- Event and listener system
- CLI console mechanism (implemented in the application layer)
Data and presentation
- Template system (DbM View Engine)
- Data access layer (Doctrine DBAL compatible Query Builder)
- Translation system
- Form validator
Infrastructure
- Session system and cookies
- File system + file and image upload
- Logger
- Error handler
- Mailer interface
- Helpers and sanitizers
The components are lightweight, modular, and can be replaced with a custom implementation (e.g., Twig instead of the built-in view engine).
The framework was designed as a modular monolith – components can be developed independently, maintaining the simplicity of implementing a single application.
Template Engine
The framework uses the lightweight DbM View Engine by default.
- Fast and dependency-free
- Based directly on PHP (no DSL)
- Extensible via callbacks
Can be replaced with another engine (e.g. Twig).
Philosophy
DBM Framework separates responsibilities into distinct layers:
- Framework = execution engine
- Application Layer = fully user-defined
- CMS / Platform = optional ecosystem extensions
The core remains lightweight, predictable, and reusable.
DBM Framework avoids heavy reflection-based autowiring and instead favors explicit dependency registration.
Services are intentionally registered using lightweight container methods such as singleton() or set(), providing predictable execution flow, lower runtime overhead, and full architectural control.
Project History
The DBM Framework evolved in stages – from a simple micro-framework to a full application ecosystem.
- v1 / v2 - project beginnings and architectural experiments
- v3 / v4 - lightweight monolithic microframework
- v5 - transition to a modular monolith architecture
- v6 - separation of the framework engine from the application layer and development of the DBM ecosystem
The current version focuses on performance, modularity, and full control over the application architecture.
Installation
Requirements:
- PHP 8.1 or later
- Composer
composer require designbymalina/dbmframework
After installation, create the application layer (bootstrap) responsible for running the framework.
Basic Usage
DBM Framework is not a standalone application. It must be used within its own application layer.
Example:
Below is a minimal example of running an application based on DBM Framework.
// example/index.php declare(strict_types=1); use Dbm\Core\Paths; $baseDirectory = realpath(dirname(__DIR__)); require_once $baseDirectory . '/vendor/autoload.php'; Paths::setBasePath($baseDirectory); $appFactory = require __DIR__ . '/bootstrap/app.php'; $app = $appFactory(); $response = $app->run(); $response->send();
Process:
- Set the base path
- Load the autoloader
- Create the application via the factory
- Start the request -> response lifecycle
Minimal application structure
- bootstrap/app.php - application factory
- bootstrap/services.php - DI container configuration
- bootstrap/controller.php - example controller
php -S localhost:8000 example/index.php
URL: http://localhost:8000/
Routing example
$router->get('/path', [NameController::class, 'methodName'], 'route_name');
A simple example of mapping a URL path to a controller.
Details:
Modular Architecture
The DBM Framework supports a modular monolith approach.
An application can be developed as a set of independent modules with a clear separation of concerns while maintaining the simplicity of a single system implementation.
Architecture Overview
The framework operates based on the following cycle:
Request -> Routing -> Middleware -> Controller -> Response
More: Architecture
The DBM framework consists of:
- kernel (request lifecycle)
- router (flexible routing)
- middleware dispatcher
- container (DI)
Design Principles
- no global state
- no hidden magic
- explicit configuration
- composition instead of inheritance
Development
Cloning the repository and installing dependencies:
git clone https://github.com/designbymalina/dbmframework
cd dbmframework
composer install
or via GitHub CLI.
When to use DBM Framework
The framework is suitable when:
- you're building your own system from scratch
- you need high performance
- you don't want an opinionated framework (like Laravel/Symfony)
- you're creating an API or backend for your application
It's not a "plug & play" framework; it requires building your own application layer.
If you need a ready-made solution, see DBM Platform.
DBM Platform - framework-based application (GitHub)
DBM Ecosystem
DBM Framework is part of a larger ecosystem:
- DBM Framework - application engine
- DBM Platform - ready-made application layer
The platform extends the framework with an administration panel, authentication, and application modules.
More: Ecosystem
Documentation
Full framework documentation is available in the /_Docs directory.
Start:
License
Project licensed under the MIT License.
Copyright (c) Design by Malina