Download the PHP package denchikby/phalcon-mongodb-odm without Composer

On this page you can find all versions of the php package denchikby/phalcon-mongodb-odm. 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 phalcon-mongodb-odm

Phalcon MongoDB ODM

Latest Stable Version Total Downloads Latest Unstable Version License

Tiny, simple and functional MongoDB ODM library for Phalcon framework for new mongodb php extension

Installation

Make sure you have the MongoDB PHP driver installed. You can find installation instructions at http://php.net/manual/en/mongodb.installation.php

Install the latest stable version using composer:

or

Configuration

Add settings and service to DI:

Creating Model

in this case will be used 'user' collection with same name as model.

To specify another collection name use getSource method:

Initialize Model

To initialize a new model instead of

use

Initialize filled model:

or

or init and save in db

Methods

To array:

Unset field:

Attributes Casting

It allow you to modify attribute type on setting/filling:

It help to save fields to db with need type, what is very important, cause mongo don't casting types in queries.

Supported types: integer, float, boolean, string, array, object, id

Casts also work in where methods of builder:

age will converted to integer and query will load normally.

Relations

There are two types of relations: one and many;

Definition:

field => [related model, type, local field, foreign field]

Relations can be loaded by two ways:

By one query:

it will use $lookup operator of aggregation framework.

By several queries, just call attribute with name of key in relations array:

Scopes

Scopes help to put common queries to methods:

Global scopes

This scope will binded to any query of model:

Mutators (getters/setters)

Mutators allow modify attributes when you getting, setting or filling it.

For example, when you creating user and set the password, hashing may be defined in model:

Events

Existed events before/after for actions save, create, update, delete.

Query Builder

Query builder could be called clearly or implicitly.

similar

Usage

Advanced Wheres

For grouping where conditions:

Query Result Collection

Every select query will return iterated collection class of models.

It could be iterated with foreach, or used as array $collection[0]->name;

Methods

Size of collection:

Will return array of assocs of each model:

Return json of array, created by toArray method:

Eager loading, similar as join:

Will load all for all comments by single query and put necessary into every document.

Grouping documents to arrays by specific field:

Keys the collection by the given key (unlike groupBy that value will single model, in groupBy array of models):

Return array of values specific field of collection:

Return associated array of specified key => value fields:

Return array of chunked collection by specified size:


All versions of phalcon-mongodb-odm with dependencies

PHP Build Version
Package Version
Requires ext-mongodb Version *
mongodb/mongodb Version ^1.0
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 denchikby/phalcon-mongodb-odm contains the following files

Loading the files please wait ....