The fastest pure PHP database framework with a powerful static code generator, supports horizontal scale up, designed for PHP7

Overview

Maghead

Build Status Coverage Status Latest Stable Version Total Downloads Monthly Downloads Daily Downloads Latest Unstable Version License Join the chat at https://gitter.im/maghead/maghead Works On My Machine Made in Taiwan

4.0.x IS CURRENTLY UNDER HEAVY DEVELOPMENT, API IS NOT STABLE

Maghead is an open-source Object-Relational Mapping (ORM) designed for PHP7.

Maghead uses static code generator to generate static classes that maps to the database records and methods, which reduces runtime costs, therefore it's pretty lightweight and extremely fast.

With the simple schema design, you can define your model schema very easily and you can even embed closure in your schema classes.

How fast is it? Currently it's the fastest ORM written in pure PHP. See the benchmark for more details.

Automatic Migration Demonstration

Feature

  • Fast & Simple
  • Configuration based on YAML format and compiled into PHP
  • PDO, MySQL, Pgsql, SQLite support.
  • Multiple data sources.
  • Mix-in model.
  • Powerful Migration Generator
    • Upgrade & Downgrade of course.
    • Automatic Migration: generate migration SQL automatically based on the schema diff.
  • Schema/Database diff

Design Concept

  • Function calls in PHP are very slow, so the model schema data will be built statically, Maghead converts all definitions (default value, validator, filter, valid value builder) into classes and static PHP array, this keeps these model classes very lightweight and fast.

  • In the runtime, all the same model objects use the same schema object, and we can reuse the prebuild data from the static schema class.

  • We keep base model class constructor empty, so when you are querying data from database, these model objects can be created with zero effort.

Getting Started

Please see the details on Wiki

Schema

Defining Schema Class

Simply extend class from Maghead\Schema\DeclareSchema, and define your model columns in the schema method, e.g.,

<?php
namespace TestApp;
use Maghead\Schema\DeclareSchema;

class BookSchema extends DeclareSchema
{

    public function schema()
    {
        $this->column('title')
            ->unique()
            ->varchar(128);

        $this->column('subtitle')
            ->varchar(256);

        $this->column('isbn')
            ->varchar(128)
            ->immutable();

        $this->column('description')
            ->text();

        $this->column('view')
            ->default(0)
            ->integer();

        $this->column('publisher_id')
            ->isa('int')
            ->integer();

        $this->column('published_at')
            ->isa('DateTime')
            ->timestamp();

        $this->column('created_by')
            ->integer()
            ->refer('TestApp\UserSchema');


        // Defining trait for model class
        $this->addModelTrait('Uploader');
        $this->addModelTrait('Downloader')
            ->useInsteadOf('Downloader::a', 'Uploader');

        $this->belongsTo('created_by', 'TestApp\UserSchema','id', 'created_by');

        /** 
         * column: author => Author class 
         *
         * $book->publisher->name;
         *
         **/
        $this->belongsTo('publisher','\TestApp\PublisherSchema', 'id', 'publisher_id');

        /**
         * accessor , mapping self.id => BookAuthors.book_id
         *
         * link book => author_books
         */
        $this->many('book_authors', '\TestApp\AuthorBookSchema', 'book_id', 'id');


        /**
         * get BookAuthor.author 
         */
        $this->manyToMany( 'authors', 'book_authors', 'author' )
            ->filter(function($collection) { return $collection; });
    }
}

Defining Column Types

$this->column('foo')->integer();
$this->column('foo')->float();
$this->column('foo')->varchar(24);
$this->column('foo')->text();
$this->column('foo')->binary();

Text:

$this->column('name')->text();

Boolean:

$this->column('name') ->boolean();

Integer:

$this->column('name')->integer();

Timestamp:

$this->column('name')->timestamp();

Datetime:

$this->column('name')->datetime();

Defining Mixin Method

namespace Maghead\Schema\Mixin;
use Maghead\Schema\MixinDeclareSchema;

class MetadataMixinSchema extends MixinDeclareSchema
{
    public function schema()
    {
        // ... define your schema here
    }

    public function fooMethod($record, $arg1, $arg2, $arg3, $arg4)
    {
        // ...
        return ...;
    }
}

Then you can use the fooMethod on your model object:

$result = $record->fooMethod(1,2,3,4);

Using Multiple Data Source

You can define specific data source for different model in the model schema:

use Maghead\Schema\DeclareSchema;

class UserSchema extends DeclareSchema {

    public function schema() {
        $this->writeTo('master');
        $this->readFrom('slave');
    }

}

Or you can specify for both (read and write):

use Maghead\Schema\DeclareSchema;

class UserSchema extends DeclareSchema {

    public function schema() {
        $this->using('master');
    }

}

Migration

If you need to modify schema code, like adding new columns to a table, you can use the amazing migration feature to migrate your database to the latest change without pain.

Once you modified the schema code, you can execute lazy diff command to compare current exisiting database table:

$ maghead diff
+ table 'authors'            tests/tests/Author.php
+ table 'addresses'          tests/tests/Address.php
+ table 'author_books'       tests/tests/AuthorBook.php
+ table 'books'              tests/tests/Book.php
+ table 'users'              tests/tests/User.php
+ table 'publishers'         tests/tests/Publisher.php
+ table 'names'              tests/tests/Name.php
+ table 'wines'              tests/tests/Wine.php

As you can see, we added a lot of new tables (schemas), and Maghead parses the database tables to show you the difference to let you know current status.

Currently Maghead supports SQLite, PostgreSQL, MySQL table parsing.

now you can generate the migration script or upgrade database schema directly.

to upgrade database schema directly, you can simply run:

$ maghead migrate auto

to upgrade database schema through a customizable migration script, you can generate a new migration script like:

$ maghead migrate diff AddUserRoleColumn
Loading schema objects...
Creating migration script from diff
Found 10 schemas to compare.
    Found schema 'TestApp\AuthorSchema' to be imported to 'authors'
    Found schema 'TestApp\AddressSchema' to be imported to 'addresses'
    Found schema 'TestApp\AuthorBookSchema' to be imported to 'author_books'
    Found schema 'TestApp\BookSchema' to be imported to 'books'
    Found schema 'TestApp\UserSchema' to be imported to 'users'
    Found schema 'TestApp\PublisherSchema' to be imported to 'publishers'
    Found schema 'TestApp\NameSchema' to be imported to 'names'
    Found schema 'TestApp\Wine' to be imported to 'wines'
Migration script is generated: db/migrations/20120912_AddUserRoleColumn.php

now you can edit your migration script, which is auto-generated:

vim db/migrations/20120912_AddUserRoleColumn.php

the migration script looks like:

class AddUserColumn_1347451491  extends \Maghead\Migration\Migration {

    public function upgrade() { 
        $this->importSchema(new TestApp\AuthorSchema);
        $this->importSchema(new TestApp\AddressSchema);

        // To upgrade with new schema:
        $this->importSchema(new TestApp\AuthorBookSchema);
        
        // To create index:
        $this->createIndex($table,$indexName,$columnNames);
        
        // To drop index:
        $this->dropIndex($table,$indexName);
        
        // To add a foreign key:
        $this->addForeignKey($table,$columnName,$referenceTable,$referenceColumn = null) 
        
        // To drop table:
        $this->dropTable('authors');
    }

    public function downgrade() { 

        $this->dropTable('authors');
        $this->dropTable('addresses');
        
    }
}

The built-in migration generator not only generates the upgrade script, but also generates the downgrade script, you can modify it to anything as you want.

After the migration script is generated, you can check the status of current database and waiting migration scripts:

$ maghead migrate status
Found 1 migration script to be executed.
- AddUserColumn_1347451491

now you can run upgrade command to upgrade database schema through the migration script:

$ maghead migrate up

If you regret, you can run downgrade migrations through the command:

$ maghead migrate down

But please note that SQLite doesn't support column renaming and column dropping.

To see what migration script could do, please check the documentation of Magsql package.

A More Advanced Model Schema

use Maghead\Schema\DeclareSchema;

class AuthorSchema extends DeclareSchema
{
    function schema()
    {
        $this->column('id')
            ->integer()
            ->primary()
            ->autoIncrement();

        $this->column('name')
            ->varchar(128)
            ->validator(function($val) { .... })
            ->filter( function($val) {  
                        return preg_replace('#word#','zz',$val);  
            })
            ->inflator(function($val) {
                return unserialize($val);
            })
            ->deflator(function($val) {
                return serialize($val);
            })
            ->validValues( 1,2,3,4,5 )
            ->default(function() { 
                return date('c');
            })
            ;

        $this->column('email')
            ->required()
            ->varchar(128);

        $this->column('confirmed')
            ->default(false)
            ->boolean();

        $this->seeds('User\\Seed')
    }
}

LICENSE

MIT License

Comments
  • Upgrade Failed

    Upgrade Failed

    在進行

    pear upgrade corneltek/LazyRecord 
    

    時,發生以下的錯誤:

    Could not chmod /path/to/docs/LazyRecord/.tmpplan.md to 644 chmod(): No such file or directory
    ERROR: commit failed
    
    opened by jaceju 10
  • SQLite adapter didn't work correctly

    SQLite adapter didn't work correctly

    運作的時候收到 PDOException SQLSTATE[HY000]: General error: 1 no such table: users

    lazy build 收到

    Building SQL for Aotoki\Model\UserSchema
    SQLSTATE[HY000]: General error: 1 table users already exists
    

    個人認為可能是 sqlite 的檔案沒有產生好⋯⋯

    data_sources:
      default:
        driver: sqlite
        database: slim
    

    目錄結構下出現了 dbname=slim 跟 slim 兩個檔案,推測問題可能在這⋯⋯

    -rw-r--r--   1 elct9620  staff    339  1 21 11:44 .lazy.php
    lrwxr-xr-x   1 elct9620  staff     22  1 21 11:35 .lazy.yml -> db/config/database.yml
    -rw-r--r--   1 elct9620  staff   1202  1 21 11:10 README.md
    -rw-r--r--   1 elct9620  staff    213  1 21 11:48 bootstrap.php
    -rw-r--r--   1 elct9620  staff   1108  1 21 11:50 composer.json
    -rw-r--r--   1 elct9620  staff  17373  1 21 11:50 composer.lock
    drwxr-xr-x   4 elct9620  staff    136  1 21 11:34 db
    -rw-r--r--   1 elct9620  staff  16384  1 21 11:38 dbname=slim
    drwxr-xr-x   3 elct9620  staff    102  1 21 11:10 logs
    -rw-r--r--   1 elct9620  staff    262  1 21 11:13 package.ini
    drwxr-xr-x   5 elct9620  staff    170  1 21 12:16 public
    -rw-r--r--   1 elct9620  staff      0  1 21 11:38 slim
    drwxr-xr-x   3 elct9620  staff    102  1 21 11:44 src
    drwxr-xr-x   4 elct9620  staff    136  1 21 11:10 templates
    drwxr-xr-x   9 elct9620  staff    306  1 21 11:32 vendor
    
    opened by elct9620 7
  • Using composer autoload but can't work correctly.

    Using composer autoload but can't work correctly.

    我使用 composer create-project slim-skeleton project 創建好基礎專案後,再加入 LazyRecord 的相依。

    然後修改 public/index.php 的requrie '../vendor/autoload.php';require '../bootstrap.php';

    db/config/database.yml 中也設定為

    
    ---
    bootstrap:
      - bootstrap.php
    

    之後 build-conf > build-schema .... (依照 Readme 設定)

    最後使用瀏覽器開啟 http://localhost/project/public/index.php (已經在 index.php 加入 config 部分)

    卻無法正常使用,將 Universal 部分先注解掉,也會碰到下面的錯誤 Fatal error: Class 'ConfigKit\ConfigCompiler' not found in /Users/elct9620/Sites/slim2/vendor/c9s/LazyRecord/src/LazyRecord/ConfigLoader.php on line 73

    而且現在似乎沒辦法在 composer 上找到 Universal 的套件。

    opened by elct9620 6
  • create/update->result->validations: different validate output

    create/update->result->validations: different validate output

    Different object result->validations output type

    If call create method, i'm receive array[stdObject]: object(stdClass)#49 (3) { ["valid"]=> bool(false) ["message"]=> string(18) "Validation failed." ["field"]=> string(10) "first_name" }

    If call update method, receive array[array]: array(3) { ["valid"]=> bool(false) ["message"]=> string(18) "Validation failed." ["field"]=> string(10) "first_name" }

    opened by dmachehin 5
  • Relationship not used all fields

    Relationship not used all fields

    Example:

    $user = new User(1);
    $out = $user->project->find(2);
    var_dump($out);
    

    In output i see sql SELECT * FROM projects WHERE id = 2 it is not used "user_id" field for where. Used mysql driver.

    User schema:

    class UserSchema extends Schema {
        public function schema() {
            //$this->table('users');
    
            $this->mixin('\SEMNavigator\Model\UserMixin');
    
            $this->column('id')->integer()->unsigned()->primary()->label('Id')->autoIncrement()->notNull();
    
            $this->column('email')->unique()->varchar(128)->immutable()->validator('ValidationKit\EmailValidator')->required()->notNull();
    
            $this->column('first_name')->varchar(40)
                ->validator('ValidationKit\StringValidator')->minLength(3)->maxLength(40)
                ->label('First name')->required()->notNull();
    
            $this->column('last_name')->varchar(40)->notNull()
                ->validator('ValidationKit\StringValidator')->minLength(3)->maxLength(40)
                ->required();
    
            $this->column('patronymic')->varchar(40)->notNull()
                ->validator('ValidationKit\StringValidator')->maxLength(3)->maxLength(40);
    
            $this->column('password')->binary(32)->immutable()->label('Password hash')->filter('SEMNavigator\Auth\Password::getHash')->notNull();
    
            $this->column('created_time')->timestamp()->default(array('CURRENT_TIMESTAMP'))->immutable()->notNull();
    
            $this->one('project', '\SEMNavigator\Model\ProjectSchema', 'user_id', 'id');
            $this->belongsTo('project', '\SEMNavigator\Model\ProjectSchema', 'user_id', 'id');
    
            $this->many('projects', '\SEMNavigator\Model\ProjectSchema', 'user_id', 'id');
        }
    }```
    
    Project schema:
    ```PHP
    class ProjectSchema extends Schema {
        public function schema() {
            $this->column('id')->integer()->unsigned()->primary()->autoIncrement()->immutable()->notNull();
    
            $this->column('user_id')->integer()->unsigned()->index()->required()->refer('\SEMNavigator\Model\UserSchema')->immutable()->notNull();
    
            $this->column('name')->varchar(100)->immutable()->validator('ValidationKit\StringValidator')->required()->notNull();
            $this->column('type')->enum(array('SITE', 'APP'))->immutable()->validator('ValidationKit\StringValidator')->required()->notNull();
            $this->column('url')->varchar(255)->immutable()->validator('ValidationKit\StringValidator')->required()->notNull();
            $this->column('is_support')->boolean()->immutable()->default(false)->notNull();
    
            $this->column('created_time')->timestamp()->default(array('CURRENT_TIMESTAMP'))->immutable()->notNull();
    
            $this->column('budget')->double()->default(0)->notNull();
    
            $this->column('deleted')->boolean()->default(false)->notNull();
            $this->column('deleted_time')->timestamp()->default(0)->notNull();
    
            $this->many('keywords', '\SEMNavigator\Model\KeywordSchema', 'project_id', 'id');
        }
    }```
    
    
    
    
    P.S. Maybe return vars type = mysql type, in php it always return string, instead numeric or float?
    
    opened by dmachehin 5
  • LazyRecord\Schema\ColumnDeclare::required() - not work

    LazyRecord\Schema\ColumnDeclare::required() - not work

    LazyRecord\Schema\ColumnDeclare method required() wrong set notNull value.

    Original: /** * This method is an alias of "notNull" */ public function required() { $this->notNull = false; return $this; }

    For fix:``` $this->notNull = true;

    bug 
    opened by dmachehin 4
  • Error in reverse parsing sqlite table schema with column defaults

    Error in reverse parsing sqlite table schema with column defaults

    PHP Schema definition

            $this->column('col1')->varchar(128)->index();
            $this->column('col2')->text();
            $this
                ->column('col3')
                ->integer()
                ->refer('AnotherSchema');
            $this->column('col4')->text()->default('-1');
            $this->belongsTo('another_id', 'AnotherSchema', 'id', 'col3');
    

    Case 1 - original column has no default value, which lazy diff run smoothly

    CREATE TABLE `pads` ( 
      `col1` TEXT,
      `col2` text,
      `col3` INTEGER REFERENCES anothers(id),
      `col4` text,
      `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
    )
    

    Case 2 - has default string value, which lazy diff will hang, seems infite loop

    CREATE TABLE `pads` ( 
      `col1` TEXT,
      `col2` text,
      `col3` INTEGER REFERENCES anothers(id),
      `col4` text DEFAULT 'o_Q',
      `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
    )
    

    Case 3 - has default numeric string value, which lazy diff reports error

    CREATE TABLE `pads` ( 
      `col1` TEXT,
      `col2` text,
      `col3` INTEGER REFERENCES anothers(id),
      `col4` text DEFAULT '123',
      `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT
    )
    

    In this case, by dumping $tableDef in TableParser/SqliteTableParser.php line 50, I got (reformatted in JSON format)

    {
        "columns": [{
            "name": "col1",
            "type": "TEXT"
        }, {
            "name": "col2",
            "type": "TEXT"
        }, {
            "name": "col3",
            "type": "INTEGER",
            "references": {
                "table": "anothers",
                "columns": ["id"],
                "actions": []
            }
        }, {
            "name": "col4",
            "type": "TEXT",
            "default": 123
        }, {
            "name": "3"
        }, {
            "name": "id",
            "type": "INTEGER",
            "notNull": true,
            "primary": true,
            "autoIncrement": true
        }]
    }
    
    bug 
    opened by Ronmi 3
  • fatal error: Call to undefined function futil_replace_extension()

    fatal error: Call to undefined function futil_replace_extension()

    I have this error while running lazy build-conf command.

    PHP Fatal error: Call to undefined function futil_replace_extension() in phar:///usr/bin/lazy/ConfigKit/ConfigCompiler.php on line 2 PHP Stack trace: PHP 1. {main}() /usr/bin/lazy:0 PHP 2. require() /usr/bin/lazy:6 PHP 3. CLIFramework\Application->run() phar:///usr/bin/lazy/scripts/lazy.emb.php:2 PHP 4. CLIFramework\CommandBase->executeWrapper() phar:///usr/bin/lazy/CLIFramework/Application.php:2 PHP 5. call_user_func_array() phar:///usr/bin/lazy/CLIFramework/CommandBase.php:2 PHP 6. LazyRecord\Command\BuildConfCommand->execute() phar:///usr/bin/lazy/CLIFramework/CommandBase.php:2 PHP 7. ConfigKit\ConfigCompiler::compile() phar:///usr/bin/lazy/LazyRecord/Command/BuildConfCommand.php:2

    I have already installed php-fileutil. I tested it with the below script and it works:

    include('FileUtil.php');
    print_r( futil_scanpath('/etc') );
    

    So it seems like somewhere's missing include('FileUtil.php'); line?

    My environment: linux mint 14, php 5.4.6 .

    opened by jtomaszewski 3
  • How to build advanced select query?

    How to build advanced select query?

    例如我有以下的 SQL :

    SELECT * FROM users WHERE id = 1 AND created >= '2012-09-27 00:00:00' AND created <= '2012-09-27 23:59:59'

    這種狀況要怎麼在 UserCollection 下條件式呢?

    opened by jaceju 3
  • fix: SqlBuilder\MySqlBuilder does not support comment of column

    fix: SqlBuilder\MySqlBuilder does not support comment of column

    範例:

    namespace YourApp\Model;
    
    use LazyRecord\Schema\SchemaDeclare;
    
    class UserSchema extends SchemaDeclare
    {
        public function schema()
        {
            // ...
            $this->column('name')
                ->varchar(10)
                ->notNull()
                ->comment('姓名');
        }
    }
    

    修正前產生的 SQL :

    name varchar(10) NOT NULL,
    

    修正後產生的 SQL :

    name varchar(10) NOT NULL COMMENT '姓名'
    
    opened by jaceju 3
  • Generic methods not used property access

    Generic methods not used property access

    Column schema strict var type (instead string), inflator work only if access to property. Generic methods getId(), getName(),... not used access to property, it get data from source $this->_data...

    Example: In Schema column i'm write $this->column('geo')->text() ->inflator(function($value) { return array_map('intval', explode(',', $value)); }) ->deflator(function($value) { return join(',', $value); }); Then output results $project->geo return array(123,456,678) $project->getGeo() return 123,456,678

    opened by dmachehin 2
  • JOIN inaccuracies

    JOIN inaccuracies

    Test code:

                $permissionName = 'resource.create';
                 $target = '2'; //dummy values
    
                $init = new PermissionAssociationCollection();
    
                $init->join(new Permission(), 'INNER', 'p')
                    ->on('m.permission_id', [ 'p.id' ]);
    
                $init->join(new Role(), 'INNER', 'r')
                    ->on('m.role_id', [ 'r.id' ]);
    
                $init->join(new RoleAssociation(), 'INNER', 'ra')
                    ->on('r.id', [ 'ra.role_id' ]);
    
                $init->where()
                    ->equal('ra.user_id', $this->userId) // 3
                    ->equal('r.tenant_id', $this->tenantId) // 1
                    ->equal('p.name', $permissionName);
    
                 $init->where()->in('m.target', [ $target, '*' ]);
    

    Since I'm specifically telling it what to join on, I expect those to be followed, however...

    It generates this (which doesn't work as intended):

    SELECT m.`id`, m.`permission_id`, m.`role_id`, m.`user_id`, m.`target`, m.`created_at`, m.`updated_at`, p.id AS p_id, p.tenant_id AS p_tenant_id, p.name AS p_name, p.created_at AS p_created_at, p.updated_at AS p_updated_at, r.id AS r_id, r.tenant_id AS r_tenant_id, r.config AS r_config, r.name AS r_name, r.created_at AS r_created_at, r.updated_at AS r_updated_at, ra.id AS ra_id, ra.role_id AS ra_role_id, ra.user_id AS ra_user_id, ra.created_at AS ra_created_at, ra.updated_at AS ra_updated_at FROM permission_associations AS m INNER JOIN permissions AS p ON (m.permission_id = p.id AND m.permission_id) INNER JOIN roles AS r ON (m.role_id) INNER JOIN role_associations AS ra ON (r.id) WHERE ra.user_id = 3 AND r.tenant_id = 1 AND p.name = 'resource.create' AND m.target IN ('2','*')
    

    when the expected output is (which does work as expected - note the join constraints added back on):

    SELECT m.`id`, m.`permission_id`, m.`role_id`, m.`user_id`, m.`target`, m.`created_at`, m.`updated_at`, p.id AS p_id, p.tenant_id AS p_tenant_id, p.name AS p_name, p.created_at AS p_created_at, p.updated_at AS p_updated_at, r.id AS r_id, r.tenant_id AS r_tenant_id, r.config AS r_config, r.name AS r_name, r.created_at AS r_created_at, r.updated_at AS r_updated_at, ra.id AS ra_id, ra.role_id AS ra_role_id, ra.user_id AS ra_user_id, ra.created_at AS ra_created_at, ra.updated_at AS ra_updated_at FROM permission_associations AS m INNER JOIN permissions AS p ON (m.permission_id = p.id AND m.permission_id) INNER JOIN roles AS r ON (m.role_id = r.id) INNER JOIN role_associations AS ra ON (ra.role_id = r.id) WHERE ra.user_id = 3 AND r.tenant_id = 1 AND p.name = 'resource.create' AND m.target IN ('2','*')
    

    What am I doing wrong here? I can PM you the Schema files or a dump of the SQL schema if you need it.

    opened by Wintereise 5
Owner
Maghead
The Fast ORM for PHP!
Maghead
MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query and get result in a fastest way. ( WEBSITE VERSION )

Mysql Optimizer mysql optimizer also known as MOP is a php query handling and manipulation library providing easy and reliable way to manipulate query

null 3 Feb 14, 2022
Laravel Code Generator based on MySQL Database

Laravel Code Generator Do you have a well structed database and you want to make a Laravel Application on top of it. By using this tools you can gener

Tuhin Bepari 311 Dec 28, 2022
A complete, simple and powerful database framework written in PHP

BaseSQL BaseSQL is a complete database framework written in PHP. It was built to accelerate projects development by handle database connections and qu

Willian Pinheiro 2 Sep 21, 2021
Orm is a simple database abstraction layer that supports postgresql.

Orm What is it Orm is a simple database abstraction layer that supports postgresql. Welcome to join us or star us for encouragement. Requires php 8.1

null 2 Sep 28, 2022
Laravel Migrations Generator: Automatically generate your migrations from an existing database schema.

Laravel Migrations Generator Generate Laravel Migrations from an existing database, including indexes and foreign keys! Upgrading to Laravel 5.4 Pleas

Bernhard Breytenbach 3.3k Dec 30, 2022
[READ-ONLY] A flexible, lightweight and powerful Object-Relational Mapper for PHP, implemented using the DataMapper pattern. This repo is a split of the main code that can be found in https://github.com/cakephp/cakephp

CakePHP ORM The CakePHP ORM provides a powerful and flexible way to work with relational databases. Using a datamapper pattern the ORM allows you to m

CakePHP 146 Sep 28, 2022
SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate.

SleekwareDB is a NoSQL database storage service. A database storage service that can be used for various platforms and is easy to integrate. NoSQL API

SleekwareDB 12 Dec 11, 2022
Tiny php mysql lib (PDO-based) with handy fetch/update functionality, supports both SQL and parametric queries

Micro PHP mysql lib (~ 200 lines of code) with ultra powerful CRUD for faster than ever development: parametric fetch/insert/update/delete (based on a

Mr Crypster 18 Dec 10, 2022
Low code , Zero Configuration ORM that creates models, config, database and tables on the fly.

?? ARCA ORM ?? Low code , Zero Configuration ORM that creates models, config, database and tables on the fly. ?? ???? Made in India ???? Complete docu

Scrawler Labs 28 Dec 18, 2022
Static testing tool for psalm plugins

Psalm test Static testing tool for psalm plugins. Installation $ composer require --dev klimick/psalm-test $ vendor/bin/psalm-plugin enable klimick/ps

Andrey K. 4 May 31, 2022
The lightweight PHP database framework to accelerate development

The lightweight PHP database framework to accelerate development Features Lightweight - Less than 100 KB, portable with only one file Easy - Extremely

Angel Lai 4.6k Dec 28, 2022
The Enobrev\ORM library is a small framework of classes meant to be used for simply mapping a mysql database to PHP classes, and for creating simply SQL statements using those classes.

The Enobrev\ORM library is a small framework of classes meant to be used for simply mapping a mysql database to PHP classes, and for creating simply SQL statements using those classes.

Mark Armendariz 0 Jan 7, 2022
[READ ONLY] Subtree split of the Illuminate Database component (see laravel/framework)

Illuminate Database The Illuminate Database component is a full database toolkit for PHP, providing an expressive query builder, ActiveRecord style OR

The Laravel Components 2.5k Dec 27, 2022
Adjacency List’ed Closure Table database design pattern implementation for the Laravel framework.

ClosureTable This is a database manipulation package for the Laravel 5.4+ framework. You may want to use it when you need to store and operate hierarc

Yan Ivanov 441 Dec 11, 2022
Phpstan-dba - database handling related class reflection extension for PHPStan & framework-specific rules

database handling class reflection extension for PHPStan This extension provides following features: PDO->query knows the array shape of the returned

Markus Staab 175 Dec 29, 2022
This package provides a framework-agnostic database backup manager for dumping to and restoring databases from S3, Dropbox, FTP, SFTP, and Rackspace Cloud

Database Backup Manager This package provides a framework-agnostic database backup manager for dumping to and restoring databases from S3, Dropbox, FT

Backup Manager 1.6k Dec 23, 2022
Laravel Inverse Seed Generator

Inverse seed generator (iSeed) is a Laravel package that provides a method to generate a new seed file based on data from the existing database table.

Orange Hill Development 2.5k Dec 29, 2022
PHP Database Migrations for Everyone

Phinx: Simple PHP Database Migrations Intro Phinx makes it ridiculously easy to manage the database migrations for your PHP app. In less than 5 minute

CakePHP 4.3k Jan 7, 2023
Database management in a single PHP file

Adminer - Database management in a single PHP file Adminer Editor - Data manipulation for end-users https://www.adminer.org/ Supports: MySQL, MariaDB

Jakub Vrána 5.5k Jan 1, 2023