Download the PHP package wasabi-web/mongodm without Composer

On this page you can find all versions of the php package wasabi-web/mongodm. 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 mongodm

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. Maintained fork of purekid/mongodm.

Features

Requirements

Installation

1. Setup in composer.json:

2. Install by composer:

$ php composer.phar update

Setup Database

Database config file (By default it locates at /vendor/wasabi-web/mongodm/config.php)

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.

Setup database in application

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

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

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

Types supported for model attributes

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.

Model CRUD

Create

Create with initial value

Create using set 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

Get using variable or method

Update

Update attributes by array

Unset attributes

Retrieve single record

retrieve one record by MongoId

Retrieve records

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

Retrieve all records

Count records

Delete record

Relationship - Reference

Lazyload a 1:1 relationship record

Lazyload 1:many relationship records

Relationship - Embed

Single Embed

Embeds

Collection

$users is instance of Collection

Save

Delete

Count

Iteration

Sort

Slice and Take

Map

Filter

Determine a record exists in the collection by object instance

Determine a record exists in the collection by numeric index

Determine a record exists in the collection by MongoID

Get a record by numeric index

Get a record by MongoID

Remove a record by numeric index

Remove a record by MongoID

Add a single record to collection

Add records to collection

Merge two collection

Export data to a array

Inheritance

Define multilevel inheritable models:

Use:

Retrieve and check value:

Retrieve subclass

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

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

Retrieve subclass without _type

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

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

Other static methods in Model

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


All versions of mongodm with dependencies

PHP Build Version
Package Version
Requires alcaeus/mongo-php-adapter Version 1.0.9
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 wasabi-web/mongodm contains the following files

Loading the files please wait ....