title: How to copy MongoDB databases using PHP now that copydb is deprecated
body: <p>In MongoDB version 4.2 <code>copydb</code> and its <code>copyDatabase</code> wrapper have been deprecated. The MongoDB manual suggests that we should now use <code>mongodump</code> and <code>mongorestore</code>. But I was calling the copy command from PHP using the PHP MongoDB driver and the dump and restore commands are commands that need to be run from the command line and don't have any PHP equivalent. How can I now copy a database using PHP?</p>