Well most of the tutorials didn't explained well, So i hope this might help someone
Note: this is a part of my laravel project
//getting data from a collection
<?php
use MongoDB\Client as Mongo;
$user = "admin";
$pwd = 'password';
$mongo = new Mongo("mongodb://${user}:${pwd}@127.0.0.1:27017");
$collection = $mongo->db_name->collection;
$result = $collection->find()->toArray();
print_r($result);
?>