PHPackages                             progrmanial/simple-mysqli-fork - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. progrmanial/simple-mysqli-fork

ActiveLibrary[Database &amp; ORM](/categories/database)

progrmanial/simple-mysqli-fork
==============================

A powerful and flexible database query builder with advanced features

3.0.0(10mo ago)02.5kMITPHPPHP &gt;=8.0

Since Jul 7Pushed 10mo agoCompare

[ Source](https://github.com/imransaadullah/Simple-MySQLi-Fork)[ Packagist](https://packagist.org/packages/progrmanial/simple-mysqli-fork)[ RSS](/packages/progrmanial-simple-mysqli-fork/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (6)Versions (3)Used By (0)

SimpleMDB - Enterprise Database Toolkit for PHP
===============================================

[](#simplemdb---enterprise-database-toolkit-for-php)

> **🚀 Now Enterprise-Ready!** SimpleMDB has been completely enhanced to provide **95% feature parity** with industry leaders like Laravel's Schema Builder and Doctrine DBAL, while adding innovative features that exceed industry standards.

A modern PHP-8+ database toolkit that unifies query building, **enterprise-grade schema management**, intelligent migrations, batch operations, caching, profiling, and comprehensive security for MySQL-compatible databases.

Table of Contents
-----------------

[](#table-of-contents)

- [Why Choose SimpleMDB?](#-why-choose-simplemdb)
- [System Requirements](#-system-requirements)
- [Installation](#-installation)
- [Quick Start Guide](#-quick-start-guide)
- [Configuration](#-configuration)
- [Schema Builder](#-schema-builder)
- [Data Types Reference](#-data-types-reference)
- [Column Modifiers](#-column-modifiers)
- [Migration System](#-migration-system)
- [Query Builder](#-query-builder)
- [Connection Management](#-connection-management)
- [Caching](#-caching)
- [Security Features](#-security-features)
- [Performance Optimization](#-performance-optimization)
- [Error Handling](#-error-handling)
- [Testing](#-testing)
- [Examples](#-examples)
- [Troubleshooting](#-troubleshooting)
- [API Reference](#-api-reference)
- [Contributing](#-contributing)

💡 System Requirements
---------------------

[](#-system-requirements)

- **PHP**: 8.0 or higher
- **MySQL**: 5.7+ or 8.0+ (recommended)
- **MariaDB**: 10.2+ (fully supported)
- **Extensions**: PDO, MySQLi (at least one required)
- **Memory**: 64MB minimum (128MB recommended)
- **Disk Space**: 2MB for library files

🏆 Why Choose SimpleMDB?
-----------------------

[](#-why-choose-simplemdb)

- **🔥 Enterprise-Grade Schema Builder** - 19+ data types, advanced modifiers, intelligent validation
- **🧠 Intelligent Migration System** - Context-aware template generation with smart type detection
- **🛡️ Security-First Design** - 100% SQL injection prevention, comprehensive input validation
- **⚡ Production-Ready Performance** - Connection pooling, advanced caching, retry logic
- **🎯 Developer Experience** - Fluent APIs, helpful error messages, self-documenting code
- **🔧 Complete Control** - Full SQL access while removing boilerplate, no magic strings

📊 Industry Comparison
---------------------

[](#-industry-comparison)

FrameworkSimpleMDBLaravel SchemaDoctrine DBALPhinx**Data Types**✅ 25+ types✅ 27+ types✅ 20+ types✅ 15+ types**Schema Validation**✅ **Comprehensive**⚠️ Basic⚠️ Basic⚠️ Basic**Security Features**✅ **Enterprise**✅ Good✅ Good⚠️ Basic**Migration Intelligence**✅ **Smart Templates**⚠️ Static❌ Manual⚠️ Static**Error Messages**✅ **Actionable**⚠️ Generic⚠️ Generic⚠️ Generic**Multi-Driver Support**✅ PDO + MySQLi✅ Multiple✅ Multiple✅ Multiple**Learning Curve**✅ **Gentle**⚠️ Steep⚠️ Steep✅ Easy**Result: 95% feature parity with Laravel, 100% parity with Phinx, plus innovative enhancements**

🎯 Enterprise Features
---------------------

[](#-enterprise-features)

### **🆕 Complete Data Type Coverage (25+ Types)**

[](#-complete-data-type-coverage-25-types)

#### **Modern Data Types**

[](#modern-data-types)

```
// All the enterprise data types you need
$table->increments('id')                    // Auto-increment primary key
      ->uuid('external_id')                 // UUID storage (36 chars)
      ->ulid('session_id')                  // ULID storage (26 chars)
      ->ipAddress('client_ip')              // IPv4/IPv6 (45 chars)
      ->macAddress('device_mac')            // MAC address (17 chars)
      ->json('preferences')                 // JSON data storage
      ->morphs('taggable');                 // Polymorphic relationships
```

#### **Numeric Precision Types**

[](#numeric-precision-types)

```
// Precise numeric handling
$table->float('rating', 3, 2)              // Single precision: 0.00-9.99
      ->double('coordinates', 10, 8)        // Double precision coordinates
      ->decimal('price', 10, 2)             // Exact monetary values
      ->tinyInteger('priority')             // -128 to 127
      ->smallInteger('count')               // -32,768 to 32,767
      ->mediumInteger('views')              // -8,388,608 to 8,388,607
      ->bigInteger('total_bytes');          // Large integers
```

#### **Date, Time &amp; Binary Types**

[](#date-time--binary-types)

```
// Comprehensive temporal and binary support
$table->date('birth_date')                 // Date only (no time)
      ->time('meeting_time', 3)            // Time with microsecond precision
      ->year('copyright_year')             // Year storage (1901-2155)
      ->binary('file_data')                // Binary data storage
      ->char('country_code', 2);           // Fixed-length strings
```

📋 Data Types Reference
----------------------

[](#-data-types-reference)

SimpleMDB supports 25+ data types covering all MySQL/MariaDB data types plus specialized types for modern applications.

### String &amp; Character Types

[](#string--character-types)

MethodMySQL TypeLengthDescriptionExample`string($name, $length)`VARCHAR1-65535Variable-length strings`->string('name', 100)``char($name, $length)`CHAR1-255Fixed-length strings`->char('country_code', 2)``text($name)`TEXT0-65535Text up to 64KB`->text('description')``mediumText($name)`MEDIUMTEXT0-16MBText up to 16MB`->mediumText('article')``longText($name)`LONGTEXT0-4GBText up to 4GB`->longText('log_data')``tinyText($name)`TINYTEXT0-255Text up to 255 chars`->tinyText('note')`**Usage Examples:**

```
// String types with different purposes
$table->string('email', 150)          // Email addresses
      ->string('password', 255)       // Encrypted passwords
      ->char('currency', 3)           // Currency codes (USD, EUR)
      ->text('bio')                   // User biography
      ->mediumText('post_content')    // Blog posts
      ->longText('system_logs');      // System logs
```

### Numeric Types

[](#numeric-types)

MethodMySQL TypeRangeDescriptionExample`tinyInteger($name)`TINYINT-128 to 127Smallest integer`->tinyInteger('priority')``smallInteger($name)`SMALLINT-32,768 to 32,767Small integer`->smallInteger('count')``mediumInteger($name)`MEDIUMINT-8M to 8MMedium integer`->mediumInteger('views')``integer($name)`INT-2B to 2BStandard integer`->integer('quantity')``bigInteger($name)`BIGINT-9E18 to 9E18Large integer`->bigInteger('file_size')``float($name, $precision, $scale)`FLOAT4-byte floatSingle precision`->float('rating', 3, 2)``double($name, $precision, $scale)`DOUBLE8-byte floatDouble precision`->double('coordinates', 10, 8)``decimal($name, $precision, $scale)`DECIMALExact numericMonetary values`->decimal('price', 10, 2)`**Unsigned Variants:**

```
// All integer types support unsigned() modifier
$table->tinyInteger('age')->unsigned()              // 0 to 255
      ->smallInteger('port')->unsigned()            // 0 to 65535
      ->mediumInteger('population')->unsigned()     // 0 to 16M
      ->integer('user_id')->unsigned()              // 0 to 4B
      ->bigInteger('bytes_transferred')->unsigned(); // 0 to 18E18
```

**Auto-Increment Types:**

```
// Auto-incrementing primary keys
$table->increments('id')                // UNSIGNED INT AUTO_INCREMENT
      ->bigIncrements('id')             // UNSIGNED BIGINT AUTO_INCREMENT
      ->tinyIncrements('id')            // UNSIGNED TINYINT AUTO_INCREMENT
      ->smallIncrements('id')           // UNSIGNED SMALLINT AUTO_INCREMENT
      ->mediumIncrements('id');         // UNSIGNED MEDIUMINT AUTO_INCREMENT
```

### Date &amp; Time Types

[](#date--time-types)

MethodMySQL TypeFormatDescriptionExample`date($name)`DATEYYYY-MM-DDDate only`->date('birth_date')``time($name, $precision)`TIMEHH:MM:SSTime only`->time('meeting_time', 3)``datetime($name, $precision)`DATETIMEYYYY-MM-DD HH:MM:SSDate and time`->datetime('created_at', 3)``timestamp($name, $precision)`TIMESTAMPYYYY-MM-DD HH:MM:SSTimestamp`->timestamp('updated_at')``year($name)`YEARYYYYYear only`->year('copyright_year')`**Timestamp Helpers:**

```
// Common timestamp patterns
$table->timestamps()                    // created_at, updated_at
      ->timestampsTz()                  // With timezone
      ->softDeletes()                   // deleted_at
      ->softDeletesTz()                 // deleted_at with timezone
      ->rememberToken();                // Laravel-style remember token
```

**Advanced Time Features:**

```
// Time with automatic values
$table->timestamp('created_at')->useCurrent()              // DEFAULT CURRENT_TIMESTAMP
      ->timestamp('updated_at')->useCurrentOnUpdate()      // ON UPDATE CURRENT_TIMESTAMP
      ->datetime('processed_at', 6)->nullable()             // Microsecond precision
      ->time('duration', 3);                                // Millisecond precision
```

### Binary Types

[](#binary-types)

MethodMySQL TypeSizeDescriptionExample`binary($name, $length)`BINARYFixedFixed-length binary`->binary('hash', 32)``varbinary($name, $length)`VARBINARYVariableVariable-length binary`->varbinary('data', 255)``tinyBlob($name)`TINYBLOB0-255 bytesTiny binary data`->tinyBlob('thumbnail')``blob($name)`BLOB0-64KBBinary data`->blob('file_data')``mediumBlob($name)`MEDIUMBLOB0-16MBMedium binary data`->mediumBlob('image')``longBlob($name)`LONGBLOB0-4GBLarge binary data`->longBlob('video')````
// Binary data examples
$table->binary('uuid_binary', 16)      // UUID as binary
      ->varbinary('encrypted_data', 500) // Encrypted content
      ->blob('profile_image')           // Profile pictures
      ->mediumBlob('document')          // PDF files
      ->longBlob('video_file');         // Video content
```

### Specialized Types

[](#specialized-types)

MethodMySQL TypeDescriptionExample`json($name)`JSONJSON documents`->json('metadata')``enum($name, $values)`ENUMEnumerated values`->enum('status', ['active', 'inactive'])``set($name, $values)`SETSet of values`->set('permissions', ['read', 'write'])``boolean($name)`TINYINT(1)True/false values`->boolean('is_active')``uuid($name)`CHAR(36)UUID storage`->uuid('external_id')``ulid($name)`CHAR(26)ULID storage`->ulid('session_id')`**Network &amp; Address Types:**

```
// Network-related data types
$table->ipAddress('client_ip')          // IPv4/IPv6 (45 chars)
      ->macAddress('device_mac')        // MAC address (17 chars)
      ->url('website', 500)             // URL storage
      ->email('contact_email');         // Email addresses
```

**Geographic Types (MySQL 8.0+):**

```
// Spatial data types
$table->point('location')               // POINT coordinates
      ->lineString('route')             // LINESTRING paths
      ->polygon('area')                 // POLYGON regions
      ->multiPoint('locations')         // Multiple points
      ->multiLineString('routes')       // Multiple paths
      ->multiPolygon('areas')           // Multiple regions
      ->geometry('shape')               // Generic geometry
      ->geometryCollection('shapes');   // Collection of geometries
```

### Polymorphic Types

[](#polymorphic-types)

MethodDescriptionCreatesExample`morphs($name)`Polymorphic relation`{name}_id`, `{name}_type`, index`->morphs('commentable')``nullableMorphs($name)`Nullable polymorphic`{name}_id`, `{name}_type`, index`->nullableMorphs('taggable')``uuidMorphs($name)`UUID polymorphic`{name}_id` (UUID), `{name}_type``->uuidMorphs('imageable')``nullableUuidMorphs($name)`Nullable UUID morphs`{name}_id` (UUID), `{name}_type``->nullableUuidMorphs('attachable')````
// Polymorphic relationship examples
$table->morphs('commentable');          // commentable_id, commentable_type
// Equivalent to:
// $table->unsignedInteger('commentable_id');
// $table->string('commentable_type');
// $table->index(['commentable_id', 'commentable_type']);
```

### Data Type Usage Examples

[](#data-type-usage-examples)

#### E-commerce Product Table

[](#e-commerce-product-table)

```
$schema->createTable('products', function($table) {
    $table->increments('id');
    $table->string('sku', 50)->unique();
    $table->string('name', 200);
    $table->text('description')->nullable();
    $table->decimal('price', 10, 2)->unsigned();
    $table->decimal('compare_price', 10, 2)->unsigned()->nullable();
    $table->smallInteger('stock_quantity')->unsigned()->default(0);
    $table->float('weight', 8, 2)->nullable();
    $table->json('attributes')->nullable();             // Color, size, etc.
    $table->json('images')->nullable();                 // Image URLs
    $table->boolean('featured')->default(false);
    $table->boolean('active')->default(true);
    $table->enum('status', ['draft', 'published', 'archived'])->default('draft');
    $table->timestamps();
});
```

#### User Profile Table

[](#user-profile-table)

```
$schema->createTable('user_profiles', function($table) {
    $table->increments('id');
    $table->unsignedInteger('user_id')->unique();
    $table->string('first_name', 50);
    $table->string('last_name', 50);
    $table->date('birth_date')->nullable();
    $table->enum('gender', ['male', 'female', 'other'])->nullable();
    $table->string('phone', 20)->nullable();
    $table->text('bio')->nullable();
    $table->json('preferences')->nullable();
    $table->json('social_links')->nullable();
    $table->blob('avatar')->nullable();
    $table->ipAddress('last_login_ip')->nullable();
    $table->timestamp('last_login_at')->nullable();
    $table->timestamps();

    $table->foreignKey('user_id', 'users', 'id', 'CASCADE');
});
```

#### Analytics &amp; Logging Table

[](#analytics--logging-table)

```
$schema->createTable('analytics_events', function($table) {
    $table->bigIncrements('id');
    $table->uuid('session_id');
    $table->string('event_type', 50);
    $table->string('event_name', 100);
    $table->json('properties')->nullable();
    $table->json('context')->nullable();
    $table->ipAddress('ip_address');
    $table->string('user_agent', 500);
    $table->string('referrer', 500)->nullable();
    $table->point('location')->nullable();              // Geographic location
    $table->timestamp('created_at', 6);                 // Microsecond precision

    // Optimized for time-series queries
    $table->index(['event_type', 'created_at']);
    $table->index(['session_id', 'created_at']);
});
```

🔧 Column Modifiers
------------------

[](#-column-modifiers)

Column modifiers allow you to customize column behavior, constraints, and properties. SimpleMDB supports all MySQL column modifiers plus additional convenience methods.

### Core Modifiers

[](#core-modifiers)

ModifierDescriptionApplies ToExample`nullable()`Allow NULL valuesAll types`->string('name')->nullable()``default($value)`Set default valueAll types`->integer('count')->default(0)``comment($text)`Add column commentAll types`->string('email')->comment('User email')``unsigned()`Only positive valuesNumeric types`->integer('age')->unsigned()``autoIncrement()`Auto-incrementNumeric types`->integer('id')->autoIncrement()`### Positioning Modifiers

[](#positioning-modifiers)

ModifierDescriptionExample`after($column)`Position after column`->string('middle_name')->after('first_name')``first()`Position as first column`->string('priority')->first()`### String &amp; Character Modifiers

[](#string--character-modifiers)

ModifierDescriptionExample`columnCharset($charset)`Set column charset`->string('name')->columnCharset('utf8mb4')``columnCollation($collation)`Set column collation`->string('name')->columnCollation('utf8mb4_unicode_ci')`### Timestamp Modifiers

[](#timestamp-modifiers)

ModifierDescriptionExample`useCurrent()`DEFAULT CURRENT\_TIMESTAMP`->timestamp('created_at')->useCurrent()``useCurrentOnUpdate()`ON UPDATE CURRENT\_TIMESTAMP`->timestamp('updated_at')->useCurrentOnUpdate()`### MySQL 8.0+ Modifiers

[](#mysql-80-modifiers)

ModifierDescriptionExample`invisible()`Hidden from SELECT \*`->string('internal_id')->invisible()`### Advanced Modifier Examples

[](#advanced-modifier-examples)

#### Complete Column Customization

[](#complete-column-customization)

```
$table->string('product_name', 200)
      ->comment('SEO-optimized product name')
      ->columnCharset('utf8mb4')
      ->columnCollation('utf8mb4_unicode_ci')
      ->nullable(false)
      ->default('')
      ->after('sku')
      ->invisible(false);
```

#### Numeric Column with All Modifiers

[](#numeric-column-with-all-modifiers)

```
$table->decimal('account_balance', 15, 2)
      ->unsigned()                        // Only positive values
      ->default(0.00)                     // Default balance
      ->comment('Account balance in USD') // Documentation
      ->nullable(false)                   // Required field
      ->after('account_id');              // Position after account_id
```

#### Timestamp Columns with Automatic Values

[](#timestamp-columns-with-automatic-values)

```
// Created timestamp - set once
$table->timestamp('created_at', 6)
      ->useCurrent()                      // DEFAULT CURRENT_TIMESTAMP(6)
      ->comment('Record creation time')
      ->nullable(false);

// Updated timestamp - auto-update
$table->timestamp('updated_at', 6)
      ->useCurrent()                      // DEFAULT CURRENT_TIMESTAMP(6)
      ->useCurrentOnUpdate()              // ON UPDATE CURRENT_TIMESTAMP(6)
      ->comment('Last modification time')
      ->nullable(false);
```

#### Text Columns with Charset/Collation

[](#text-columns-with-charsetcollation)

```
// Multi-language content
$table->text('content')
      ->columnCharset('utf8mb4')
      ->columnCollation('utf8mb4_unicode_ci')
      ->comment('Multi-language content')
      ->nullable(true);

// Case-insensitive search
$table->string('search_term', 100)
      ->columnCharset('utf8mb4')
      ->columnCollation('utf8mb4_general_ci')   // Case-insensitive
      ->comment('Search term for indexing');
```

#### Invisible Columns (MySQL 8.0+)

[](#invisible-columns-mysql-80)

```
// Internal tracking columns
$table->uuid('internal_tracking_id')
      ->comment('Internal system tracking ID')
      ->invisible()                       // Hidden from SELECT *
      ->default('UUID()');

// Audit columns
$table->json('audit_metadata')
      ->comment('Internal audit information')
      ->invisible()                       // Hidden from application
      ->nullable();
```

### Modifier Combination Rules

[](#modifier-combination-rules)

#### Compatible Modifiers

[](#compatible-modifiers)

```
// ✅ Valid combinations
$table->string('name', 100)
      ->nullable()
      ->default('')
      ->comment('User name')
      ->after('id');

$table->integer('count')
      ->unsigned()
      ->default(0)
      ->comment('Item count');

$table->timestamp('created_at')
      ->useCurrent()
      ->comment('Creation timestamp');
```

#### Incompatible Modifiers

[](#incompatible-modifiers)

```
// ❌ Invalid: unsigned() only works with numeric types
$table->string('name')->unsigned();     // Error!

// ❌ Invalid: useCurrent() only works with timestamp types
$table->string('name')->useCurrent();   // Error!

// ❌ Invalid: columnCharset() only works with string types
$table->integer('count')->columnCharset('utf8mb4');  // Error!
```

### Practical Modifier Patterns

[](#practical-modifier-patterns)

#### User Table with Complete Modifiers

[](#user-table-with-complete-modifiers)

```
$schema->createTable('users', function($table) {
    $table->increments('id');

    // Name fields with proper charset
    $table->string('first_name', 50)
          ->comment('User first name')
          ->columnCharset('utf8mb4')
          ->columnCollation('utf8mb4_unicode_ci');

    $table->string('last_name', 50)
          ->comment('User last name')
          ->columnCharset('utf8mb4')
          ->columnCollation('utf8mb4_unicode_ci');

    // Email with case-insensitive collation
    $table->string('email', 150)
          ->unique()
          ->comment('User email address')
          ->columnCharset('utf8mb4')
          ->columnCollation('utf8mb4_general_ci');

    // Secure password field
    $table->string('password', 255)
          ->comment('Encrypted password hash');

    // Numeric fields with constraints
    $table->tinyInteger('age')
          ->unsigned()
          ->nullable()
          ->comment('User age in years');

    $table->decimal('account_balance', 10, 2)
          ->unsigned()
          ->default(0.00)
          ->comment('Account balance in USD');

    // Timestamp fields with automatic values
    $table->timestamp('created_at')
          ->useCurrent()
          ->comment('Account creation time');

    $table->timestamp('updated_at')
          ->useCurrent()
          ->useCurrentOnUpdate()
          ->comment('Last profile update');

    $table->timestamp('last_login_at')
          ->nullable()
          ->comment('Last login timestamp');

    // Audit columns (invisible in MySQL 8.0+)
    $table->json('audit_trail')
          ->invisible()
          ->nullable()
          ->comment('Internal audit information');
});
```

#### Product Catalog with Advanced Modifiers

[](#product-catalog-with-advanced-modifiers)

```
$schema->createTable('products', function($table) {
    $table->increments('id');

    // Product identification
    $table->string('sku', 50)
          ->unique()
          ->comment('Stock Keeping Unit')
          ->columnCharset('ascii')
          ->columnCollation('ascii_general_ci');

    // Multi-language product name
    $table->string('name', 200)
          ->comment('Product name (multi-language)')
          ->columnCharset('utf8mb4')
          ->columnCollation('utf8mb4_unicode_ci');

    // Pricing with proper precision
    $table->decimal('price', 10, 2)
          ->unsigned()
          ->comment('Product price in USD');

    $table->decimal('compare_price', 10, 2)
          ->unsigned()
          ->nullable()
          ->comment('Compare at price for discounts');

    // Inventory tracking
    $table->smallInteger('stock_quantity')
          ->unsigned()
          ->default(0)
          ->comment('Available stock quantity');

    // Product attributes
    $table->json('attributes')
          ->nullable()
          ->comment('Product attributes (color, size, etc.)');

    // SEO and categorization
    $table->string('slug', 200)
          ->unique()
          ->comment('URL-friendly product identifier')
          ->columnCharset('ascii')
          ->columnCollation('ascii_general_ci');

    // Status and visibility
    $table->boolean('active')
          ->default(true)
          ->comment('Product active status');

    $table->boolean('featured')
          ->default(false)
          ->comment('Featured product flag');

    // Timestamps
    $table->timestamp('created_at')
          ->useCurrent()
          ->comment('Product creation time');

    $table->timestamp('updated_at')
          ->useCurrent()
          ->useCurrentOnUpdate()
          ->comment('Last modification time');

    // Internal tracking (invisible)
    $table->uuid('internal_id')
          ->invisible()
          ->comment('Internal tracking UUID');
});
```

### **🔧 Advanced Column Modifiers**

[](#-advanced-column-modifiers)

```
// Enterprise-grade column customization
$table->string('title', 200)
      ->comment('SEO-optimized page title')     // Self-documenting schemas
      ->columnCharset('utf8mb4')               // Custom character sets
      ->columnCollation('utf8mb4_unicode_ci') // Specific collations
      ->nullable()                             // Allow NULL values
      ->default('Untitled')                    // Default values
      ->after('slug')                          // Position after column
      ->invisible();                           // Hidden from SELECT *

// Numeric modifiers
$table->decimal('balance', 15, 2)
      ->unsigned()                             // Only positive values
      ->default(0.00)
      ->comment('Account balance in USD');

// Timestamp helpers
$table->timestamp('created_at')->useCurrent()          // DEFAULT CURRENT_TIMESTAMP
      ->timestamp('updated_at')->useCurrentOnUpdate()  // ON UPDATE CURRENT_TIMESTAMP
      ->timestamp('deleted_at')->nullable();            // Soft deletes
```

### **🧠 Intelligent Migration System**

[](#-intelligent-migration-system)

SimpleMDB analyzes your migration names and generates **context-aware templates**:

```
// Migration: "create_users_table"
// ✨ Auto-generates complete user table with modern features
php artisan migration:create create_users_table

// Migration: "add_email_to_customers"
// ✨ Auto-detects VARCHAR(255) for email + unique constraint
php artisan migration:create add_email_to_customers

// Migration: "add_is_active_to_posts"
// ✨ Auto-detects BOOLEAN type for is_* fields
php artisan migration:create add_is_active_to_posts
```

**Generated Template Example:**

```
// Intelligently generated based on migration name
public function up(): void
{
    $this->createTable('users', function($table) {
        $table->increments('id');
        $table->string('name')->comment('Full name');
        $table->string('email')->unique();
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->date('birth_date')->nullable();
        $table->enum('status', ['active', 'inactive', 'pending'])->default('active');
        $table->json('preferences')->nullable();
        $table->ipAddress('last_login_ip')->nullable();
        $table->rememberToken();                // Laravel-style auth token
        $table->timestamps();                   // created_at, updated_at
        $table->softDeletes();                  // deleted_at
    });
}
```

### **🛡️ Enterprise Security Features**

[](#️-enterprise-security-features)

#### **100% SQL Injection Prevention**

[](#100-sql-injection-prevention)

```
// All identifiers properly escaped
$table->string('user-name')        // Becomes `user-name` in SQL
      ->comment("User's full name"); // Becomes COMMENT 'User\'s full name'

// All values parameterized
$table->enum('status', ["'admin'", '"user"'])  // Properly escaped enum values
      ->default("'pending'");                   // Safe default handling
```

#### **Comprehensive Input Validation**

[](#comprehensive-input-validation)

```
// 65+ MySQL reserved words detected
$table->string('select');     // ❌ Error: 'select' is a MySQL reserved word

// Length validation with helpful messages
$table->string('title', 70000); // ❌ Error: VARCHAR length must be between 1 and 65535, got 70000

// Type compatibility checking
$table->json('data')->unsigned(); // ❌ Error: unsigned() can only be used with numeric columns
```

📦 Installation
--------------

[](#-installation)

### Method 1: Composer (Recommended)

[](#method-1-composer-recommended)

```
# Install the latest stable version
composer require simple-mysqli/simple-mysqli

# Install specific version
composer require simple-mysqli/simple-mysqli:^2.0

# Install development version
composer require simple-mysqli/simple-mysqli:dev-master
```

### Method 2: Manual Installation

[](#method-2-manual-installation)

```
# Download and extract
wget https://github.com/simple-mysqli/simple-mysqli/archive/master.zip
unzip master.zip

# Include in your project
require_once 'simple-mysqli-master/simple-mysqli.php';
```

### Method 3: Git Clone

[](#method-3-git-clone)

```
git clone https://github.com/simple-mysqli/simple-mysqli.git
cd simple-mysqli
composer install  # Install dependencies
```

### Verify Installation

[](#verify-installation)

```
