MongoDB ORM that includes support for references,embed and multilevel inheritance.

Related tags

Database mongodm
Overview

image

SensioLabsInsight Build Status Latest Stable Version Total Downloads License

Introduction

Mongodm is a MongoDB ORM that includes support for references,embed and even multilevel inheritance.

Features

  • ORM
  • Simple and flexible
  • Support for embed
  • Support for references (lazy loaded)
  • Support for multilevel inheritance
  • Support for local collection operations

Requirements

  • PHP 5.3 or greater (Tested for 5.5,5.6,7.0,7.1)
  • Mongodb 1.3 or greater
  • PHP Mongo extension

Installation

1. Setup in composer.json:

	{
		"require": {
		    "purekid/mongodm": "dev-master"
		}
	}

2. Install by composer:

$ php composer.phar update

Setup Database

Database config file (By default it locates at /vendor/purekid/mongodm/config.php)

	return array(
        'default' => array(
    		'connection' => array(
    			'hostnames' => 'localhost',
    			'database'  => 'default',
    // 			'username'  => '',
    // 			'password'  => '',
    		)
    	),
    	'production' => array(
    		'connection' => array(
    			'hostnames' => 'localhost',
    			'database'  => 'production',
    			'options' => array('replicaSet' => 'rs0')
    		)
    	)
    );

Authentication

Authentication information is passed in via the options array. If you do not specifiy authSource, then the PHP Mongo Driver will choose the "admin" database.

$config =  array( 'connection' => array(
      'hostnames' => '<host>:<port>',
      'database'  => '<databasename>',
      'options'  => [ "connectTimeoutMS" => 500 , "username" => "admin", "password" => "<password>", "authSource" => "admin"] )
  );

Setup database in application

1.You can set up configuration using the MongoDB::setConfigBlock method.

\Purekid\Mongodm\MongoDB::setConfigBlock('default', array(
    'connection' => array(
        'hostnames' => 'localhost',
        'database'  => 'default',
        'options'  => array()
    )
));

// 
\Purekid\Mongodm\MongoDB::setConfigBlock('auth', array(
    'connection' => array(
        'hostnames' => 'localhost',
        'database'  => 'authDB',
        'options'  => array()
    )
));

2.Or you can duplicate a config file into your project, then define a global constanct 'MONGODM_CONFIG' with it's location.

//in a global initialization place

define('MONGODM_CONFIG',__DIR__."/../config/mongodm.php");

Choose config section with APPLICATION_ENV

Which config section Mongodm use ? Mongodm choose 'default' section by default.

You have two ways to specify section :

1.'$config' attribute in Model , you can find this attribute in example below.

2.With environment constanct 'APPLICATION_ENV' ,this constanct can be set by webserver,your code or shell environment. In this case,you should set $config='default' or don't declare $config in your own model class.

Create a model and enjoy it

    
    use Purekid\Mongodm\Model;
    
    class User extends Model 
    {
    
        static $collection = "user";
        
        /** use specific config section **/
        public static $config = 'testing';
        
        /** specific definition for attributes, not necessary! **/
        protected static $attrs = array(
                
             // 1 to 1 reference
            'book_fav' => array('model'=>'Purekid\Mongodm\Test\Model\Book','type'=> Model::DATA_TYPE_REFERENCE),
             // 1 to many references
            'books' => array('model'=>'Purekid\Mongodm\Test\Model\Book','type'=> Model::DATA_TYPE_REFERENCES),
            // you can define default value for attribute
            'age' => array('default'=>16,'type'=> Model::DATA_TYPE_INTEGER),
            'money' => array('default'=>20.0,'type'=> Model::DATA_TYPE_DOUBLE),
            'hobbies' => array('default'=>array('love'),'type'=> Model::DATA_TYPE_ARRAY),
            'born_time' => array('type'=> Model::DATA_TYPE_TIMESTAMP),
            'family'=>array('type'=> Model::DATA_TYPE_OBJECT),
            'pet_fav' => array('model'=>'Purekid\Mongodm\Test\Model\Pet','type'=> Model::DATA_TYPE_EMBED),
            'pets' => array('model'=>'Purekid\Mongodm\Test\Model\Pet','type'=> Model::DATA_TYPE_EMBEDS),
                
        );

        public function setFirstName($name) {
        	$name = ucfirst(strtolower($name));
        	$this->__setter('firstName', $name);
        }

        public function getLastName($name) {
        	$name = $this->__getter('name');
        	return strtoupper($name);
        }
    
    }

Types supported for model attributes

    [
	'mixed',  // mixed type 
	'string',     
	'reference',  // 1 : 1 reference
	'references', // 1 : many references
	'embed', 
	'embeds', 
	'integer',  
	'int',  // alias of 'integer'
	'double',     // float 
	'timestamp',  // store as MongoTimestamp in Mongodb
	'date',  // store as DateTime
	'boolean',    // true or false
	'array',    
	'object'
    ];

    const DATA_TYPE_ARRAY      = 'array';
    
    const DATA_TYPE_BOOL       = 'bool';
    const DATA_TYPE_BOOLEAN    = 'boolean';

    const DATA_TYPE_DATE       = 'date';

    const DATA_TYPE_DBL        = 'dbl';
    const DATA_TYPE_DOUBLE     = 'double';
    const DATA_TYPE_FLT        = 'flt';
    const DATA_TYPE_FLOAT      = 'float';

    const DATA_TYPE_EMBED      = 'embed';
    const DATA_TYPE_EMBEDS     = 'embeds';

    const DATA_TYPE_INT        = 'int';
    const DATA_TYPE_INTEGER    = 'integer';

    const DATA_TYPE_MIXED      = 'mixed';

    const DATA_TYPE_REFERENCE  = 'reference';
    const DATA_TYPE_REFERENCES = 'references';

    const DATA_TYPE_STR        = 'str';
    const DATA_TYPE_STRING     = 'string';

    const DATA_TYPE_TIMESTAMP  = 'timestamp';

    const DATA_TYPE_OBJ        = 'obj';
    const DATA_TYPE_OBJECT     = 'object';
    

If you put a object instance into a Model attribute and this attribute is undefined in $attrs of Model class,the data of attribute will be omitted when Model saving.

    
    $object = new \stdClass();  
    $object->name = 'ooobject';
    
    $user = new User();
    $user->name = 'michael';
    $user->myobject = $object;    // this attribute will be omitted when saving to DB 
    $user->save();

Model CRUD

Create

	$user = new User();
	$user->name = "Michael";
	$user->age = 18;
	$user->save();

Create with initial value

	$user = new User( array('name'=>"John") );
	$user->age = 20;
	$user->save();

Create using set method

	$user->setLastName('Jones'); // Alias of $user->lastName = 'Jones';
	$user->setFirstName('John'); // Implements setFirstName() method

Set and get values

You can set/get values via variable $user->name = "John" or by method $user->getName().

Set using variable or method

 	// no "set" method exists
	$user->lastName = 'Jones';
	$user->setLastName('Jones');

	// "set" method exists implements setFirstName()
	$user->firstName = 'jOhn'; // "John"
	$user->setFirstName('jOhn'); // "John"

Get using variable or method

 	// "get" method exists implements getLastName()
	print $user->lastName; // "JONES"
	print $user->getLastName(); // "JONES"

	// no "get" method
	print $user->firstName; // "John"
	print $user->setFirstName('John'); // "John"

Update

	$user->age = 19;

Update attributes by array

	$user->update( array('age'=>18,'hobbies'=>array('music','game') ) ); 
	$user->save();

Unset attributes

	$user->unset('age');
	$user->unset( array('age','hobbies') );
	//or
	unset($user->age);

Retrieve single record

	$user = User::one( array('name'=>"michael" ) );

retrieve one record by MongoId

	$id = "517c850641da6da0ab000004";
	$id = new \MongoId('517c850641da6da0ab000004'); //another way
	$user = User::id( $id );

Retrieve records

Retrieve records that name is 'Michael' and acount of owned books equals 2

	$params = array( 'name'=>'Michael','books'=>array('$size'=>2) );
	$users = User::find($params);     // $users is instance of Collection
	echo $users->count();

Retrieve all records

	$users = User::all();

Count records

	$count = User::count(array('age'=>16));

Delete record

	$user = User::one();
	$user->delete();	

Relationship - Reference

Lazyload a 1:1 relationship record

	$book = new Book();
	$book->name = "My Love";
	$book->price = 15;
	$book->save();

	// !!!remember you must save book before!!!
	$user->book_fav = $book;
	$user->save();

	// now you can do this
	$user = User::one( array('name'=>"michael" ) );
	echo $user->book_fav->name;

Lazyload 1:many relationship records

	$user = User::one();
	$id = $user->getId();

	$book1 = new Book();
	$book1->name = "book1";
	$book1->save();
	
	$book2 = new Book();
	$book2->name = "book2";
	$book2->save();

	$user->books = array($book1,$book2);
	//also you can
	$user->books = Collection::make(array($book1,$book2));
	$user->save();

	//somewhere , load these books
	$user = User::id($id);
	$books = $user->books;      // $books is a instance of Collection

Relationship - Embed

Single Embed

	$pet = new Pet();
	$pet->name = "putty";

	$user->pet_fav = $pet;
	$user->save();

	// now you can do this
	$user = User::one( array('name'=>"michael" ) );
	echo $user->pet_fav->name;

Embeds

	$user = User::one();
	$id = $user->getId();
	
	$pet_dog = new Pet();
	$pet_dog->name = "puppy";
	$pet_dog->save();
	
	$pet_cat = new Pet();
	$pet_cat->name = "kitty";
	$pet_cat->save();

	$user->pets = array($pet_cat,$pet_dog);
	//also you can
	$user->pets = Collection::make(array($pet_cat,$pet_dog));
	$user->save();

	$user = User::id($id);
	$pets = $user->pets;     

Collection

$users is instance of Collection

	$users = User::find(  array( 'name'=>'Michael','books'=>array('$size'=>2) ) );    
	$users_other = User::find(  array( 'name'=>'John','books'=>array('$size'=>2) ) );   

Save

    $users->save() ;  // foreach($users as $user) { $user->save(); }

Delete

    $users->delete() ;  // foreach($users as $user) { $user->delete(); }

Count

	$users->count();  
	$users->isEmpty();

Iteration

	foreach($users as $user) { }  
	
	// OR use Closure 
	
	$users->each(function($user){
	
	})

Sort

	//sort by age desc
	$users->sortBy(function($user){
	    return $user->age;
	});
	
	//sort by name asc
	$users->sortBy(function($user){
	    return $user->name;
	} , true);
	
	//reverse collection items
	$users->reverse();

Slice and Take

	$users->slice(0,1);
	$users->take(2);

Map

	$func = function($user){
		  		if( $user->age >= 18 ){
		    		$user->is_adult = true;
	        	}
	            return $user;
			};
	
	$users->map($func)->save();   
	

Filter

	$func = function($user){
	        	if( $user->age >= 18 ){
	    			return true;
	    		}
			}

	$adults = $users->filter($func); // $adults is a new collection

Determine a record exists in the collection by object instance

	$john = User::one(array("name"=>"John"));
	
	$users->has($john) 

Determine a record exists in the collection by numeric index

	$users->has(0) 

Determine a record exists in the collection by MongoID

	$users->has('518c6a242d12d3db0c000007') 

Get a record by numeric index

	$users->get(0) 

Get a record by MongoID

	$users->get('518c6a242d12d3db0c000007') 

Remove a record by numeric index

	$users->remove(0)  

Remove a record by MongoID

	$users->remove('518c6a242d12d3db0c000007') 

Add a single record to collection

	$bob = new User( array("name"=>"Bob"));
	$bob->save();
	$users->add($bob);

Add records to collection

	$bob = new User( array("name"=>"Bob"));
	$bob->save();
	$lisa = new User( array("name"=>"Lisa"));
	$lisa->save();
	
	$users->add( array($bob,$lisa) ); 

Merge two collection

	$users->add($users_other);  // the collection $users_other appends to end of $users 

Export data to a array

	$users->toArray();

Inheritance

Define multilevel inheritable models:

	use Purekid\Mongodm\Model;
	namespace Demo;
	
	class Human extends Model{
	
		static $collection = "human";
		
		protected static $attrs = array(
			'name' => array('default'=>'anonym','type'=>'string'),
			'age' => array('type'=>'integer'),
			'gender' => array('type'=>'string'),
			'dad' =>  array('type'=>'reference','model'=>'Demo\Human'),
			'mum' =>  array('type'=>'reference','model'=>'Demo\Human'),
			'friends' => array('type'=>'references','model'=>'Demo\Human'),
		)
	
	}

	class Student extends Human{
	
		protected static $attrs = array(
			'grade' => array('type'=>'string'),
			'classmates' => array('type'=>'references','model'=>'Demo\Student'),
		)
		
	}

Use:

	$bob = new Student( array('name'=>'Bob','age'=> 17 ,'gender'=>'male' ) );
	$bob->save();
	
	$john = new Student( array('name'=>'John','age'=> 16 ,'gender'=>'male' ) );
	$john->save();
	
	$lily = new Student( array('name'=>'Lily','age'=> 16 ,'gender'=>'female' ) );
	$lily->save();
	
	$lisa = new Human( array('name'=>'Lisa','age'=>41 ,'gender'=>'female' ) );
	$lisa->save();
	
	$david = new Human( array('name'=>'David','age'=>42 ,'gender'=>'male') );
	$david->save();
	
	$bob->dad = $david;
	$bob->mum = $lisa;
	$bob->classmates = array( $john, $lily );
	$bob->save();

Retrieve and check value:

	$bob = Student::one( array("name"=>"Bob") );
	
	echo $bob->dad->name;    // David
	
	$classmates = $bob->classmates;
	
	echo $classmates->count(); // 2
    
	var_dump($classmates->get(0)); // john	

Retrieve subclass

Retrieve all Human records , queries without '_type' because of it's a toplevel class.

    $humans = Human::all();

Retrieve all Student records , queries with { "_type":"Student" } because of it's a subclass.

    $students = Student::all();

Retrieve subclass without _type

To retrieve a record without the _type criteria (i.e. { "_type":"Student" }) set:

class Student extends \Purekid\Mongodm\Model
{
    protected static $useType = false;

    protected static $collection = 'Student';
}

Make sure to set a collection otherwise you will get results with every _type.

Other static methods in Model

	User::drop() // Drop collection 
	User::ensureIndex()  // Add index for collection

Model Hooks

The following hooks are available:

__init()

Executed after the constructor has finished

__preInsert()

Executed before saving a new record

__postInsert()

Executed after saving a new record

__preUpdate()

Executed before saving an existing record

__postUpdate()

Executed after saving an existing record

__preSave()

Executed before saving a record

__postSave()

Executed after saving a record

__preDelete()

Executed before deleting a record

__postDelete()

Executed after deleting a record

Special thanks to

mikelbring Paul Hrimiuc

Comments
  • Remove MongoId requirement

    Remove MongoId requirement

    Hi! as far as i can tell, the model _id has to be a MongoId. that isn't a requirement for mongodb and there are a few cases where specifying a different type of ID makes sense.

    I would love to be able to use this ODM but that limitation prevents it ;(

    bug enhancement 
    opened by nodefortytwo 13
  • Issue creating new record using model constructor

    Issue creating new record using model constructor

    Here is a simple test that will fail.

    <?php
    
    namespace Purekid\Mongodm\Test;
    
    use Purekid\Mongodm\Test\TestCase\PhactoryTestCase;
    use Purekid\Mongodm\Test\Model\Pupil;
    
    class BugTest extends PhactoryTestCase {
    
        public function testInit()
        {
            $id = new \MongoId();
            $data = array('_id' => $id);
            $user = new Pupil($data);
            $user->save();
    
            $testUser = Pupil::id($id);
    
            $this->assertNotEmpty($testUser);
    
        }
    }
    

    This issue occurs when _Id is passed to constructor. As far as I see this is related to this line of code: https://github.com/purekid/mongodm/blob/master/src/Purekid/Mongodm/Model.php#L108

    bug question 
    opened by wildsurfer 11
  • 1:M relationship

    1:M relationship

    I am trying to follow your example but not sure where I'm going wrong with this:

    $user = new User(); $user->first_name = "tester"; $user->save();

    $id = $user->_id;

    $relationship = new Relationship(); $relationship->is_confirmed = true; $relationship->save();

    $user->relationships = Purekid\Mongodm\Collection::make(array($relationship));

    $user->save();

    Reading this exception: MongoException: zero-length keys are not allowed, did you use $ with double quotes?

    In User.php 'relationships' => array( 'model' => 'RelationShip', ' type' => 'references' )

    Any hint?

    opened by squidge 10
  • Mongodm can not be use in Phalcon?

    Mongodm can not be use in Phalcon?

    I have this question when create new model: Argument 2 passed to Purekid\Mongodm\MongoDB::__construct() must be of the type array, null given, called in C:\xampp\htdocs\guppys\common\Library\Vendor\purekid\mongodm\src\Purekid\Mongodm\MongoDB.php on line 66 and defined

    opened by wughvor 5
  • Embedding: where's the id of the embedded object?

    Embedding: where's the id of the embedded object?

    Hi! I was trying to save with embedded models, but I cannot retrieve the MongoId of the embedded object. My case is:

    <?php
    namespace Demo;
    
    require 'vendor/autoload.php';
    
    use Purekid\Mongodm\Model;
    
    class Human extends Model{
    	
    	static $collection = "human";
    	
    	protected static $attrs = array(
    		'name' => array('default'=>'anonym','type'=>'string'),
    		'dad' =>  array('type'=>'embed','model'=>'Demo\Human'),
    		'mum' =>  array('type'=>'embed','model'=>'Demo\Human'),
    	);
    	
    }
    
    
    
    $bob = new Human( array('name'=>'Bob') );
    $bob->save();
    
    $lisa = new Human( array('name'=>'Lisa') );
    $lisa->save();
    
    $david = new Human( array('name'=>'David') );
    $david->save();
    
    $bob->dad = $david;
    $bob->mum = $lisa;
    
    $bob->save();
    
    
    $bob = Human::one( array("name"=>"Bob") );
    
    print_r($bob->toArray());
    

    I was expected to see the MongoId objects into the mum and dad objects, but I see this

    Array
    (
        [_id] => MongoId Object
            (
                [objectID:MongoId:private] => MongoDB\BSON\ObjectId Object
                    (
                        [oid] => 5accb8a7c9153174bb3fe532
                    )
    
            )
    
        [name] => Bob
        [dad] => Array
            (
                [name] => David
                [age] => 42
                [gender] => male
            )
    
        [mum] => Array
            (
                [name] => Lisa
                [age] => 41
                [gender] => female
            )
    
    )
    

    How can I see the MongoId id of the embedded objects? It seems that doesn't save them..

    opened by falco442 4
  • Add child embeds changes.

    Add child embeds changes.

    If one embed has more embed data or an a collection of embeds the save not process don't push the changes to parent document.

    EX: Document->Embed->Embeds->Embed (don't track this changes)

    Document->Album->Photo->name

    opened by jmartin82 4
  • MongoCursorException

    MongoCursorException

    Guys,

    preciso tratar um problema, porem com try catch o mesmo continua a explodir. Podem me ajudar?

    MongoCursorException [ 11000 ]: localhost:27017: E11000 duplicate key error index: mobeli.users.$email_1 dup key: { : null }

    Try:

    public function action_test() {

        $signup = new \users\Model_Signup();
        $signup->first_name = "João Vagner";
        $signup->last_name = "Brito de Medeiros";
        $signup->emails = array('default' => '[email protected]');
    
    
        try {
            $signup->save();
        } catch (MongoCursorException $e) {
            echo "Exceção pega: ", $e->getMessage(), "\n";
        }
    
    
        die('oi');
    }
    
    opened by JoaoVagner 4
  • Add mutate method to model

    Add mutate method to model

    Add ability to mutate the data directly (i.e. use $inc and other MongoDB operators.) This protects data from loss where find -> mutate -> save would lose any transactions in between requests.

        // {... age: 16 ...}
        user = User::one();
        $id = $user->getId();
        $age = $user->age;
    
        $user->mutate(array('$inc' => array('age' => 1)));
        // {... age: 17 ...}
    

    This could have serious effects such as:

        // {... age: 16 ...}
        $user->mutate(array('age' => 1));
        // { age: 16 }
    
    opened by jrschumacher 4
  • Inconsistent behavior when Mongo is not running

    Inconsistent behavior when Mongo is not running

    With MongoDB stopped mongodm throws an exception, which is expected. But if we try to save something again, it crashes:

    PHP Fatal error: Call to a member function selectCollection() on null in /home/willian/htdocs/test/vendor/purekid/mongodm/src/Purekid/Mongodm/MongoDB.php on line 708

    <?php
    require 'vendor/autoload.php';
    
    \Purekid\Mongodm\MongoDB::setConfigBlock('default', array(
        'connection' => array(
            'hostnames' => 'localhost',
            'database'  => 'test'
        )
    ));
    
    class Test extends \Purekid\Mongodm\Model {
        protected static $collection = "test";
    }
    
    $record = new Test();
    
    try {
        $record->save();
    }
    catch (\Exception $e) {
        echo 'Catch exception #1 ', PHP_EOL;
    }
    
    try {
        $record->save();
    }
    catch (\Exception $e) {
        //
        echo 'Catch exception #2 ', PHP_EOL;
    }
    
    bug 
    opened by willianpts 3
  • Model (with Reference to Json)

    Model (with Reference to Json)

    I have a function need to return a model in json (with all fields, several of them are references). The output, however, only gives "$id" and "$ref" fields instead of the referenced object.

    opened by joesonw 3
  • Packagist.org AutoUpdate Hook

    Packagist.org AutoUpdate Hook

    Please add an auto update hook to packagist.org

    It is highly recommended to set up the GitHub service hook for all your packages. This reduces the load on our side, and ensures your package is updated almost instantly. To do so you can go to your GitHub repository, click the "Admin" button, then "Service Hooks". Pick "Packagist" in the list, and add the API key you will find on your profile, plus your Packagist username if it is not the same as on GitHub. Check the "Active" box and submit the form.

    opened by jrschumacher 3
  • MongoDM not fully support PHP 7.1/PHP 7.2/PHP7.0 for find() function

    MongoDM not fully support PHP 7.1/PHP 7.2/PHP7.0 for find() function

    While I install the php from https://webtatic.com/packages/php71/#sapis for PHP7.2 ,PHP7.1 and PHP7.0, I have try to use find() function but the system throw me the error below. I install PHP7.2 in windows by XAMPP is working fine with mongodm.

    Argument 3 passed to MongoDB\Driver\Server::executeQuery() must be an instance of MongoDB\Driver\ReadPreference or null, array given

    Kindly provide new fix for this issues.

    opened by bc96123 0
  • Error in example

    Error in example

    I am using v1.5.0. The readme says, in the connection section:

    \Purekid\Mongodm\MongoDB::setConfigBlock

    But the correct class is:

    \Purekid\Mongodm\MongoDB::ConnectionManager::setConfigBlock

    opened by ramiromd 0
  • Regex query is not working.

    Regex query is not working.

    I am not sure what I am doing wrong but this below query is not working, can you help?

            if($this->input->has('filter')){
                $filter =  array( 'name' => array( '$regex' => $this->input->get('filter')) );
            }else{
                $filter = [];
            }
            $rawBrands = Brands::find($filter, ['name' => 1], [], 20, $skip);
    

    I get no results, but if I executed the same query directly in mongodb I get lots of matched records, is $regex working in this lib? The result that i get is always empty, but it should not be the case, either I should get all the brands or the brands that match the filter and yes I do have lots of documents in brand collection which match the search criteria.

    opened by prashanthsun9 1
  • Method conflicts with magic methods

    Method conflicts with magic methods

    I noticed there are numerous method conflicts with getEmbed, setEmbed, getConnection, etc. These all create issues with the the magic methods found here: https://github.com/purekid/mongodm/blob/master/src/Purekid/Mongodm/Model.php#L1504-L1513

    bug 
    opened by jrschumacher 0
Releases(v1.5.0)
Owner
Michael Gan
Michael Gan
Analogue ORM : Data Mapper ORM for Laravel/PHP

(this project is looking for a new maintainer) Analogue ORM Analogue is a flexible, easy-to-use ORM for PHP. It is a transposition of the Eloquent ORM

Analogue ORM 632 Dec 13, 2022
Extend Jenssegers/laravel-mongodb to support transaction function

Laravel Mongodb (Transactional support) Introduction Jensseger's laravel-mongodb extension package is very popular among Laravel developers, but it la

Iman RJ 10 Nov 1, 2022
A MongoDB based Eloquent model and Query builder for Laravel (Moloquent)

Laravel MongoDB This package adds functionalities to the Eloquent model and Query builder for MongoDB, using the original Laravel API. This library ex

Jens Segers 6.3k Jan 5, 2023
MongoDB PHP library

MongoDB PHP Library This library provides a high-level abstraction around the lower-level PHP driver (mongodb extension). While the extension provides

mongodb 1.5k Dec 31, 2022
Psalm Stubs for doctrine/mongodb-odm library

doctrine-mongodb-psalm-plugin A Doctrine plugin for Psalm (requires Psalm v4). Installation: $ composer require --dev runtothefather/doctrine-mongodb-

Evgeny 6 Jun 15, 2022
Simple MongoDB API for PHP!

SimpleMongo SimpleMongo is a simple API for MongoDB, written in PHP. How to use? First of all, copy SimpleMongo.php into your project and fill the fir

AlicanCopur 9 Jul 19, 2021
Eloquent MongoDB Repository Implementation

Eloquent MongoDB Repository Eloquent MongoDB Repository using nilportugues/repository as foundation, using jenssegers/mongodb. Installation Use Compos

Nil Portugués Calderó 18 Feb 12, 2022
RockMongo is a MongoDB administration tool, written in PHP 5.

Introduction -------------------------------------- RockMongo is a MongoDB administration tool, written in PHP 5, very easy to install and use. Inst

Liu Xiangchao 1k Dec 27, 2022
Migrations for MongoDB based on PHPMongo ODM

PHPMongo Migrator Migrations for MongoDB based on PHPMongo ODM Schema not required in MongoDb, so we dont need to create databases, collections or alt

Sokil 29 Jul 13, 2022
Simple MySQL library for PHP 5.4+ includes Query Builder, PDO Native functions, Helper functions for quick use.

Simple MySQL library for PHP 5.4+ includes Query Builder, PDO Native functions, Helper functions for quick use.

Kodols 9 Dec 22, 2022
ORM layer that creates models, config and database on the fly

RedBeanPHP 5 RedBeanPHP is an easy to use ORM tool for PHP. Automatically creates tables and columns as you go No configuration, just fire and forget

Gabor de Mooij 2.2k Jan 9, 2023
A drop-in Doctrine ORM 2 implementation for Laravel 5+ and Lumen

Laravel Doctrine ORM A drop-in Doctrine ORM 2 implementation for Laravel 5+ $scientist = new Scientist( 'Albert', 'Einstein' ); $scientist->a

Laravel Doctrine 777 Dec 17, 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
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
Doctrine Object Relational Mapper (ORM)

3.0.x 2.9.x 2.8.x Doctrine 2 is an object-relational mapper (ORM) for PHP 7.1+ that provides transparent persistence for PHP objects. It sits on top o

Doctrine 9.5k Jan 2, 2023
Baum is an implementation of the Nested Set pattern for Laravel's Eloquent ORM.

Baum Baum is an implementation of the Nested Set pattern for Laravel 5's Eloquent ORM. For Laravel 4.2.x compatibility, check the 1.0.x branch branch

Estanislau Trepat 2.2k Jan 3, 2023
Propel2 is an open-source high-performance Object-Relational Mapping (ORM) for modern PHP

Propel2 Propel2 is an open-source Object-Relational Mapping (ORM) for PHP. Requirements Propel uses the following Symfony Components: Config Console F

Propel 1.2k Dec 27, 2022
PHP DataMapper, ORM

Cycle ORM Cycle is PHP DataMapper, ORM and Data Modelling engine designed to safely work in classic and daemonized PHP applications (like RoadRunner).

Cycle ORM 1.1k Jan 8, 2023
Extensions for the Eloquent ORM

Sofa/Eloquence Easy and flexible extensions for the Eloquent ORM. Currently available extensions: Searchable query - crazy-simple fulltext search thro

Jarek Tkaczyk 1.1k Dec 20, 2022