Download the PHP package trismegiste/yuurei without Composer

On this page you can find all versions of the php package trismegiste/yuurei. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package yuurei

Yuurei (幽霊) Build Status

Atomicity in MongoDB explained by Xzibit

What

It's a micro database layer with automatic mapping. It is intended for advanced users of MongoDB who know and understand the growth of a model on a schemaless database.

When I mean "micro", I mean the sum of NCLOC is less than the infamous method UnitOfWork::createEntity of Doctrine 2

Of course, features are also "micro". Don't expect the impossible. Nevertheless there are some functionalities you don't find anywhere else.

Plus, this DBAL is fully extendable. My other repo DokudokiBundle for symfony2 adds 3 more mapping systems with minimum coding.

How

Use Composer like any other PHP package :

Why

Because, like the cake, "ODM is a lie". Turning MongoDB into an ORM-like abstraction is the worst thing you can do against a NoSQL database.

With an ODM, you loose both NoSQL and RDBMS features, here are some :

In fact ODM is a slow ORM without ACID : what is the point of using MongoDB ?

That's why I stop chasing the "Mythical Object Database" and start hacking.

Guidances

So, you make a model divided in few parts without circular reference, and you store it. It's like serialization but in MongoDB.

All non static properties are stored in a way you can query easily with the powerfull (but very strange I admit) language of MongoDB.

See the PHPUnit tests for examples of the serialization process.

It's like serialization

You know PHP can save and restore any object in session with the serialization and it doesn't need any mapping information, annotations nor repositories. This was my paradigm when I started this library.

Why can't an ORM/ODM do the same ? Well, of course I needed a NoSQL database. But this dbal/odm-like does not need any mappping information and objects stored in the database are keeping their original structures (without too much noise). So you can make complex queries with MongoDb.

See full example in unit test

About MDE

With recent concepts of NoSQL, SOA and HMVC, I believe MDE is somewhat past-history, not always but very often. In fact it's not the MDE itself but a very common anti-pattern : the "Database Driven Development" where all source code come from the database schema. Combined with CRUD generators, it leads to anemic model, dumb constructors and useless setters/getters without business meaning.

About performance

todo

FAQ

What are the requirements ?

How to map properties ?

All object's properties are stored. You have only one thing to do : The root classes must implement the Persistable interface (there is a trait for implementing this interface). You don't need to extend any particuliar class, therefore you can follow the DDD without constraint.

What is a "root class" ?

It is a class stored in the collection, which contains the MongoId in the key '_id'. All other agregated objects in this class don't need to implement Persistable, they are recursively stored.

What are the constraints ?

This library cannot save & restore private properties coming from a parent class. Private properties in persisted classes are ok but they will not be seen by subclasses and therefore cannot be persisted if you save these subclasses in the database. This is a big limitations so be careful when you use the keyword 'private'.

How can I remove some transient properties ?

You can't. But you can have a transient class with the interface Skippable. Use Decorator pattern or a State Pattern. Your model can do that.

Can I make some cleaning before persistence ?

Like serialization, you can implement Cleanable with 2 methods : wakeup and sleep

How can I query for listing ?

Use the MongoCollection, you can't be more efficient than this low level layer

How can I store pictures or PDF ?

Use a MongoBinData in your model, it is stored as is

Can I use something else than MongoId for primary key ?

No. Of course MongoDB allow you to use something else but it is not a very good idea for the most case.

What about MongoDate ?

Any DateTime are converted into MongoDate and vice versa.

What are the guidances you have used for this lib ?

Is there any lazy loading or proxy classes for DBRef ?

Fly, you fools

What is the meaning of Yuurei ?

In fact this lib was part of DokudokiBundle and I wanted to keep the best from this Bundle in a standalone library. So I kept a japanese name for this. 幽霊 means ghost or spirit because in the original bundle, this mapping system was named "Invocation".


All versions of yuurei with dependencies

PHP Build Version
Package Version
Requires php Version >=5.5
ext-mongo Version >=1.5.0
trismegiste/alkahest Version ~2.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package trismegiste/yuurei contains the following files

Loading the files please wait ....