O'Reilly logo

Getting Started with Laravel 4 by Raphaël Saunier

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Rolling out your own artisan commands

Maybe at this stage you might be thinking about writing your own bespoke commands. As you will see, this is surprisingly easy to do with Artisan. If you have used Symfony's Console component, you will be pleased to know that an Artisan command is simply an extension of it with a slightly more expressive syntax. This means that the various helpers will prompt for input, show a progress bar, or format a table, all available from within Artisan.

The command that we are going to write depends on the application we built in Chapter 3, Your First Application. It will allow you to export all cat records present in the database as a CSV with or without a header line. If no output file is specified, the command will ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required