Package Data | |
---|---|
Maintainer Username: | markustripp |
Maintainer Contact: | markus@mext.at (Markus Tripp) |
Package Create Date: | 2017-08-10 |
Package Last Update: | 2018-03-12 |
Language: | PHP |
License: | MIT |
Last Refreshed: | 2025-02-06 03:06:04 |
Package Statistics | |
---|---|
Total Downloads: | 20,446 |
Monthly Downloads: | 481 |
Daily Downloads: | 13 |
Total Stars: | 10 |
Total Watchers: | 2 |
Total Forks: | 7 |
Total Open Issues: | 0 |
See Laravel 5.5 Package Development
composer create-project laravel/laravel myproject dev-develop
cd myproject
composer require markustripp/mongo
php artisan vendor:publish
Now you are ready to use the Mongo Facade, e.g. open routes/web.php:
<?php
Route::get('mongo', function(Request $request) {
$collection = Mongo::get()->mydatabase->mycollection;
return $collection->find()->toArray();
});
Route::get('/', function () {
return view('welcome');
});
Add a document to mycollection in mydatabase and open the browser at http://myproject.dev/mongo
To override the default MongoDB connection configuration add the following parameters to your .env file. Find a detailed description on the MongoDB Driver Manager Page. Use JSON notation within single quotes '
for options.
MONGO_URI=mongodb://127.0.0.1:27017
MONGO_URI_OPTIONS='{"appname": "app", "replicaSet": "repl"}'
MONGO_DRIVER_OPTIONS=