<?php
var_dump((string) new MongoDB\BSON\ObjectId());
var_dump((string) new MongoDB\BSON\ObjectId('000000000000000000000001'));
?>
The above example will output
something similar to:
string(24) "56731b49da14d8747d701211"
string(24) "000000000000000000000001"