Download the PHP package bonesmccoy/bongo-fixture-loader without Composer
On this page you can find all versions of the php package bonesmccoy/bongo-fixture-loader. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Table of contents
Download bonesmccoy/bongo-fixture-loader
More information about bonesmccoy/bongo-fixture-loader
Files in bonesmccoy/bongo-fixture-loader
Download bonesmccoy/bongo-fixture-loader
More information about bonesmccoy/bongo-fixture-loader
Files in bonesmccoy/bongo-fixture-loader
Vendor bonesmccoy
Package bongo-fixture-loader
Short Description simple mongo fixture loader
License MIT
Package bongo-fixture-loader
Short Description simple mongo fixture loader
License MIT
Please rate this library. Is it a good library?
Informations about the package bongo-fixture-loader
Bongo Fixture Loader
Bon(es)(mon)go fixture loader for mongodb.
I know that I'm reinventing the weel, but sometimes it's nice to behave like a caveman ;)
Installation
$ composer require-dev bonesmccoy/bongo-fixture-loader
Configuration
Create a yaml file into
mongo_data_store:
db_name: your_db_name
host: localhost
port: 27017
username: ''
password: ''
connect: true
fixtures:
paths:
- path/to/fixture/from/project/root
Create one or more fixtures in the configured path:
<collectionname>:
- object 1
- object 2
- object 3
Special Field Syntax
- to get an ObjectId (or MongoId in PHP)
"_id" : "<id@{24 CHARS HEX STRING}>
- to get a DateTime object
"dateTimeField" : "<YYYY-MM-DD HH:mm:SS>"
"dateField": "<YYYY-MM-DD>"
Example of a list of forum post, where the first is the parent of the second:
posts:
- {"_id" : "<id@56eb45003639330941000001>", "parentId" : "<id@56eb45003639330941000001>", "senderId" : 1, 'title' : 'title 1', 'body' : 'body content 1', 'date' : '<2016-03-04 12:00:00>' }
- {"_id" : "<id@56eb45003639330941000002>", "parentId" : "<id@56eb45003639330941000001>", "senderId" : 2, 'title' : 'title', 'body' : 'body content 2', 'date' : '<2016-03-04 13:00:00>' }
will be saved as :
{
"_id" : ObjectId('56eb45003639330941000001'),
"parentId: ObjectId('56eb45003639330941000001'),
"senderId": 1,
...
...
"date" : ISODate('2016-03-04 12:00:00')
}
{
"_id" : ObjectId('56eb45003639330941000002'),
"parentId: ObjectId('56eb45003639330941000001'),
"senderId": 1,
...
...
"date" : ISODate('2016-03-04 13:00:00')
}
Usage
Load fixtures:
$ bin/bongo-load /path/to/bongo.yml
Requirements
- PHP > 5.4
- mongo extension
- symfony/yaml
All versions of bongo-fixture-loader with dependencies
PHP Build Version
Package Version
The package bonesmccoy/bongo-fixture-loader contains the following files
Loading the files please wait ...