Skip to content

mersolution/mikoorm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

16 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Miko ORM Documentation

Docs PHP Coverage

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.


πŸš€ Why Miko ORM?

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.

✨ Core Features

  • 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.

πŸ“– Quick Links

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

🏁 Getting Started

To begin using Miko ORM, visit the Documentation Home to learn how to install the package and configure your database connection.


Miko ORM is a lightweight and fast database framework for PHP with fluent query syntax.

🏁 Getting Started

To begin using Miko ORM, check out the Installation guide to set up your environment and start building your next high-performance application.


Miko ORM is a lightweight and fast database framework for PHP with fluent query syntax.

Installation

Include Miko ORM in your project by requiring the autoload.php file:

require_once 'Model/Miko/autoload.php';

Quick Start

1. Define Your Model

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'];
}

2. Configure Database Connection

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();

3. Start Using

// 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();

Supported Databases

Database Driver Default Port
MySQL / MariaDBmysql3306
PostgreSQLpgsql5432
SQLitesqlite-
SQL Serversqlsrv1433

Project Structure

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

Key Features

Feature Description
Model-First MigrationAuto-create tables from model definitions
Fluent Query BuilderClean and intuitive query API
RelationsHasOne, HasMany, BelongsTo, BelongsToMany
ObserversModel lifecycle events (creating, created, updating, etc.)
Bulk OperationsEfficient bulk insert, update, upsert, delete
JSON ColumnsNative JSON support with dot notation access
Validation AttributesPHP 8 attributes for model validation
Connection PoolEfficient database connection management
Query CacheCache query results with tags
Soft DeletesSoft delete support with restore capability
TransactionsTransaction support with savepoints

Next Steps

Documentation Description
Database ConfigConfigure your database connection
ORM ModelLearn about model definitions
Query BuilderBuild complex queries
RelationsDefine model relationships
CRUD ExamplesComplete CRUD examples

Releases

No releases published

Packages

 
 
 

Contributors

Languages