Miko ORM is a lightweight, high-performance PHP ORM and fluent query builder designed for modern PHP applications.
The framework provides a clean and expressive interface for interacting with relational databases while maintaining high performance and minimal complexity. Explore the full capabilities at mikoorm.com.
Modern PHP applications require a reliable and efficient database abstraction layer. Miko ORM offers a perfect balance between simplicity and power:
- Lightweight Architecture: Minimal overhead and optimized performance.
- Fluent Query Builder: Chainable methods for flexible and readable queries.
- Model-Based Interaction: Clean, object-oriented database management.
- Improved Readability: Reduces code complexity and enhances maintainability.
- High Performance: Optimized specifically for modern PHP environments.
- Model-Based Access: Define models that represent your database tables and interact with them using clean, object-oriented syntax.
- Fluent Query Builder: Build complex SQL queries using a readable and chainable interface.
- Optimized Performance: Built for speed without unnecessary dependencies.
- Developer-Friendly: Designed to maximize productivity by reducing boilerplate code.
- Flexible Integration: Perfect for microservices, APIs, and large-scale applications.
To get started, please visit our dedicated documentation pages:
| Resource | Link |
|---|---|
| Official Website | mikoorm.com |
| Full Documentation | mikoorm.com/docs |
| Installation Guide | Get Started Here |
To begin using Miko ORM, visit the Documentation Home to learn how to install the package and configure your database connection.
To begin using Miko ORM, check out the Installation guide to set up your environment and start building your next high-performance application.
Include Miko ORM in your project by requiring the autoload.php file:
require_once 'Model/Miko/autoload.php';use Miko\Database\ORM\Model;
use Miko\Database\ORM\Traits\HasTimestamps;
class User extends Model
{
use HasTimestamps;
protected static string $table = 'users';
protected static string $primaryKey = 'Id';
protected array $fillable = ['Name', 'Email', 'Password', 'Role'];
protected array $hidden = ['Password'];
}use Miko\Database\ORM\DbContext;
class AppDbContext extends DbContext
{
protected function configure(): void
{
$this->setConnection('mysql', [
'host' => 'localhost',
'database' => 'your_database',
'username' => 'root',
'password' => '',
'charset' => 'utf8mb4'
]);
}
}
// Initialize
$db = new AppDbContext();// Create
$user = User::create([
'Name' => 'John Doe',
'Email' => 'john@example.com'
]);
// Read
$user = User::find(1);
$users = User::where('IsActive', true)->get();
// Update
$user->Name = 'John Updated';
$user->save();
// Delete
$user->delete();| Database | Driver | Default Port |
|---|---|---|
| MySQL / MariaDB | mysql | 3306 |
| PostgreSQL | pgsql | 5432 |
| SQLite | sqlite | - |
| SQL Server | sqlsrv | 1433 |
your-project/
βββ Model/
β βββ Miko/ # Miko ORM Framework
β βββ autoload.php # Include this file
β βββ Cache/
β βββ Core/
β βββ Database/
β βββ Library/
β βββ Log/
βββ App/
β βββ Models/ # Your models
β β βββ User.php
β β βββ Product.php
β βββ DbContext.php # Your database context
βββ .env # Environment configuration
| Feature | Description |
|---|---|
| Model-First Migration | Auto-create tables from model definitions |
| Fluent Query Builder | Clean and intuitive query API |
| Relations | HasOne, HasMany, BelongsTo, BelongsToMany |
| Observers | Model lifecycle events (creating, created, updating, etc.) |
| Bulk Operations | Efficient bulk insert, update, upsert, delete |
| JSON Columns | Native JSON support with dot notation access |
| Validation Attributes | PHP 8 attributes for model validation |
| Connection Pool | Efficient database connection management |
| Query Cache | Cache query results with tags |
| Soft Deletes | Soft delete support with restore capability |
| Transactions | Transaction support with savepoints |
| Documentation | Description |
|---|---|
| Database Config | Configure your database connection |
| ORM Model | Learn about model definitions |
| Query Builder | Build complex queries |
| Relations | Define model relationships |
| CRUD Examples | Complete CRUD examples |