Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer. You can expect quick tips, links to interesting tutorials, opinions and packages. Want to learn the cool stuff? Then sign up now!

Add a command to dump your database in Laravel 5

This Laravel 5 package provides an artisan command to dump your database to a file. When installed you can dump your database with this command

php artisan db:backup

A file containing the dump of your database will be created in the directory you specified in the config-file.

I plan on adding support for using Laravel 5 Cloud storage in the near future. It will then be possible your dump on cloud based storage such as S3 or Dropbox.



Freek Van der Herten is a partner and developer at Spatie, an Antwerp based company that specializes in creating web apps with Laravel. After hours he writes about modern PHP and Laravel on this blog. When not coding he’s probably rehearsing with his kraut rock band. He loves waffles and butterflies.
  • Alex Mansour

    Hello @freek can we dump the DB to CSV file format using this package ?

    • No, currently only an sql dump is supported.

      • Alex Mansour

        Thanks for your quick reply.

        Is it possible that we extend the package related functions to make it work with both SQL and CSV ?

        If so, any tips ?

        • Under the hood this package uses mysqldump to create a dumped version from the database. I’ve never researched it but maybe some options can be passed to it to export a csv.

          If it turns out to be possible and the code the achieve this is simple, I’d accept a PR