Download the PHP package mawelous/yamop-laravel without Composer
On this page you can find all versions of the php package mawelous/yamop-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download mawelous/yamop-laravel
More information about mawelous/yamop-laravel
Files in mawelous/yamop-laravel
Package yamop-laravel
Short Description Yet another MongoDB ODM for PHP as Laravel Component. Nothing unnecessary, with easy joins.
License MIT
Homepage https://github.com/mawelous/yamop-laravel
Informations about the package yamop-laravel
Yamop for Laravel
Yet another MongoDB ODM for PHP as Laravel Component
- What's that?
- Requirements
- Installation
- Usage
- Pagination
- Authentication
- Issues
- License
What's that?
This is yet another, open source, and very simple MongoDB ODM for Laravel 4. It works like the standard MongoDB PHP extension interface but returns objects instead of arrays (as ODM). Queries stay the same. One of its coolest features are joins which allow you to query for related objects. This version for Laravel is based on Yamop which can be included into any PHP project. In addition to the standard features it supports Laravel based authentication.
Requirements
- PHP 5.3+
- PHP MongoDB Extension
- Laravel 4
Installation
You can simply download it here or use Composer.
In the require
key inside the composer.json
file add the following
Save it and run the Composer update command
$ composer update
After this is done, add mongo
in your database configuration:
Now we need to let Laravel know about this new service provider. To do so add under providers
in the config\app.php
file the following:
Aliases to the Yamop classes are useful. Add them in the aliases
array in the config\app.php
file:
To use Yamop you now just need to extend the Yamop alias Model
from within any of your new or existing models:
That's it!
Usage
For usage examples and further explanation take a look at the Yamop Documentation. In this release for Laravel you can also use aliases for Mapper
and Model
which were registered during installation. See the following pagination example.
Pagination
Yamop for Laravel supports pagination out of the box. It implements the _createPaginator
method and extends getPaginator
, with this you only need to pass the items per page into the method. The second parameter which is the current page number, and the third which is the page parameter name are both optional.
Authentication
Laravel's package of Yamop supports native like authentication.
You must first extend your User
Model with Yamop's Mawelous\YampoLaravel\User
In auth\config.php
change the driver to yamop
.
Now you can implement it as standard authentication:
Issues
Any issues or questions please report here
License
Yamop is free software distributed under the terms of the MIT license