Products
Mongo ODM
Why to use this ODM? You can easily work with document data through comfortable getters and setters instead of array and don't check if key exist in array. Access to subdocument use dot-syntax. You can validate data passed to document before save. We give you events, which you can handle in different moments of document's life, and more things which make you life easier.
Github: https://github.com/sokil/php-mongo
Documentation: https://github.com/sokil/php-mongo/blob/master/README.md
Download: https://github.com/sokil/php-mongo/releases/latest
Install through Composer:
composer require sokil/php-mongo
News
2017-11-10 Released v. 1.22.2
- Add $elemMatch to projection argument of `Cursor`
- `Cursor` methods `findOne`, `findAll`, `findRandom` deprecated, use `one`, `all` and `random` respectively;
- Allow pass filter to docker tests
- Document's `afterConstruct` event triggered with document instance
- Cache now compatible with PSR-16;
- Cache setters now return bool instead of exceptions to be compatible with PSR-16;
- Cache::setNeverExpired and Cache::setDueDate now deprecated. Use Cache::set instead;
2017-06-20 Released v. 1.21.5
- Fix collection creation with empty options
- Allow specify validator while create collection
- Fixed mispell in method name BatchInsert::isValidationEbabled
- Fixed usage of validation flag in BatchInsert
- `Document::beforeConstruct` moved to `Structure::beforeConstruct` so embedded documents may configure some logic there
- `Collection::batchDelete()` now has required argument
- Now may be configured batch limit in `Cursor::copyToCollection` and `Cursor::moveToCollection`
- Methods of `\Iterator` interface currently not recommended to use directly in `Cursor` and `Paginator`. But if used, now `rewind` MUST be calls before `current`.
- Remove debug logger calls
2017-01-17 Released v.1.20
- Implemented support of new ext-mongodb and, as a result, PHP7 and HHVM through compatibility layer "alcaeus/mongo-php-adapter", which implement API from old ext-mongo extension;
- Cursor::findOne() throws internal `CursorException` exception instead of related to mongo extension. Exception from extension may be obtained from internal exception;
- Document::save() throws internal `WriteException` exception instead of related to mongo extension. Exception from extension may be obtained from internal exception;
- Docker tests now check PHP 7 code
- Structure::apply() now protected
2016-12-18 Released v.1.19.2
- Fix bug in Document::addToSet
- Fixed bug #132
- Configure document pool status in collection's mapping;
- Collection::_mongoCollection is deprecated. Use `Collection::getMongoCollection()` instead;
- Collection::ensureIndex() is deprecated, use `Collection::createIndex()`;
- Cursor::toArray() removed, use `Cursor::getMongoQuery()`;
- Document::belongsToCollection() removed, use `Collection::hasDocument()`;
- Document::FIELD_TYPE_* constants removed, use `FieldType` enum
- Collection::_database removed, use Collection::getDatabase() instead;
2016-09-13 Released v.1.18.2
2016-08-18 Released v.1.18.1
2016-08-16 Released v.1.17
- `Client::$_mapping` set private. `Use Client::map()`
- Configure document class if collection class also configured by class prefix #128
2016-06-27 Released v.1.16.1
- Fixed aggregation pipeline setter
2016-06-23 Released v.1.16
- Allow set embedded document and validate it;
- `\Sokil\Mongo\Structure\Arrayable` moves to `\Sokil\Mongo\ArrayableInterface`;
- `Structure::$_modifiedFields` and `Structure::$_originalData` set private;
- Document::_data is now deprecated, and replaced with protected property Document::schema;
- Documents not allowed to be cloned;
- Removed 'validator' suffix from names of validation errors in array of validation errors obtained from Document::getErrors();
2016-04-27 Released v1.15.2
- Update version of Event Dispatcher
2016-03-10 Released v.1.15.1
2016-03-01 Released v.1.15
- Removed `Collection::createPipeline()`. Use `Collection::createAggregator`;
- Aggregator options may be passed as arguments of `Collection::aggregate($pipelines, $options)` or configured
through methods of `Pipeline`;
- Experimental feature: aggregation returns Cursor, if third parameter passed `Collection::aggregate($pipelines, $options, $asCursor)`;
- `Collection::explainAggregate()` is deprecated. Use `Pipeline::explain()`;
- Added debug mode to `Client`;
2016-01-30 Released v.1.14
2016-01-13 Released v.1.13.9
- Fixed bug #121 - Getting relation when document pool disabled
2016-01-01 Released v.1.13.8
2015-09-27 Released v.1.13.7
2015-08-25 Released v.1.13.6
- Support of $unwind pipeline in aggregation
2015-08-07 Released v.1.13.5
- Fix getting HAS_ONE and BELONGS relation when related object not found
2015-07-27 Released v.1.13.4
- Cache detected db version
- Cursor autocomplete improves
2015-07-06 Released v.1.13.3
- Use MongoWriteBatch classes when using unit of work
2015-05-22 Released v.1.13.2
- Added support of cursor timeouts
2015-05-14 Released v.1.13.1
- Added Database::getLastError()
2015-05-03 Released v.1.13
- Optimistic locking
- Refactoring of mapping configs.
- Default argument removed from `Collection::getOption()`.
- Removed deprecated method `Collection::saveDocument()`.
- Removed deprecated method `Client::setConnection()`. Use Client::setMongoClient().
- Removed deprecated method `Client::getConnection()`. Use Client::getMongoClient().
- Removed `Document::pushFromArray()`. Use `Document::pushEach()`.
- Removed `Paginator::setQueryBuilder()’. Use `Paginator::setCursor()`.
- Removed `Document::fromArray()`. Use `Document::merge()` instead.
- Removed `Structure::load()`. Use `merge` or `mergeUnmidified` instead.
- Revision methods moved to `RevisionManager`. Call them from `Document` instance directly is deprecated. Use `Document::getRevisionManager()` instead.
- Mark Document::_scenario as private.
- Define relations in mapping.
- `Operator::getAll()` is deprecated. Use `Operator::toArray()`.
- Protected access of property Structure::_modifiedFields is deprecated. Use self::getModifiedFields().
- Protected access of property Structure::_originalData is deprecated. Use self::getOriginalData().
- Removed classes QueryBuilder and GridFSQueryBuilder. Hydration logic improved
- Refactor document saving
- Collection::deleteDocument() is deprecated. Use Document::delete()
- Collection::isVersioningEnabled() and Collection::enableVersioning() are deprecated. Use 'vrsioning' in mapping.
- Collection properties 'documentClass', 'versioning', '_index' and '_queryExpressionClass' are deprecated. Use mapping declarations instead.
2015-03-03 Released v.1.12.8
- Method 'Validator::validate()' marked as final
- Refactoring of document relations
- Document::belongsToCollection() now deprecated. Use Collection::hasDocument()
- Refactoring of document events
2015-02-20 Released v.1.12.7
- Define cursor's batch size
2015-02-06 Released v.1.12.6
- Accept expression array and callable when call `Collection::getDistinct()`
2015-02-01 Released v.1.12.5
- Fix update when expression defined as callable
- Fix deleting documents when expression specified as callable
2015-01-27 Released v.1.12.4
- If callable in `Dollection::getDocument()` specified, document always loaded directly omitting document pool.
- Fixed 'in' validator when custom error message specified
- Dependency from major version number of Symfony Event Dispatcher
2015-01-18 Released v.1.12.3
- Fixed bug with naming of validator in errors array. Removed suffix 'validator'.
- Behavior refactoring.
- Old validator name is kept for back compatibility and will be removed in next versions
Mongo Migrator
Migration manager for MongoDB
Schema not required in MongoDb, so we dont need to create databases, collections or altering them. However there are some cases when migrations required in schemaless databases:
- Creating collections with special parameters, like capped collection;
- Renaming or deleting collections;
- Creating, renaming or deleting fields;
- Creating, changing or deleting indexes
Github and documentation: https://github.com/sokil/php-mongo-migrator
Download: https://github.com/sokil/php-mongo-migrator/releases/latest
Install through Composer:
{
"require": {
"sokil/php-mongo-migrator": "dev-master"
}
}
Install phar:
wget http://phpmongokit.github.io/dists/mongo-migrator.phar && chmod +x mongo-migrator.phar && sudo mv mongo-migrator.phar /usr/local/bin
Mongo ODM Symfony bundle
Github and documentation: https://github.com/sokil/php-mongo-bundle
Download: https://github.com/sokil/php-mongo-bundle/releases/latest
Install through Composer:
{
"require": {
"sokil/php-mongo-bundle": "dev-master"
}
}
Laravel PHPMongo Adapter
Github and documentation: https://github.com/sokil/laravel-mongo-odm
Download: https://github.com/sokil/laravel-mongo-odm/releases/latest
Install through Composer:
composer require phpmongokit/laravel-mongo-odm
Mongo ODM Yii adapter
Consists of PHPMongo adapter, data provider and log router for MongoDb.
Github and documentation: https://github.com/sokil/php-mongo-yii
Download: https://github.com/sokil/php-mongo-yii/releases/latest
Install through Composer:
{
"require": {
"sokil/php-mongo-yii": "dev-master"
}
}
Mongo ODM Yii2 adapter
Consists of PHPMongo adapter for MongoDb.
Github and documentation: https://github.com/PHPMongoKit/yii2-mongo-odm
Download: https://github.com/PHPMongoKit/yii2-mongo-odm/releases/latest
Install through Composer:
composer require phpmongokit/yii2-mongo-odm