O'Reilly logo

CakePHP 1.3 Application Development Cookbook by Mariano Iglesias

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

Parsing command line parameters

The recipe Building and running a shell showed us how to create a shell that adds records based on user-provided information. This recipe adds support to import accounts from a CSV file, while allowing the user to configure different settings through the use of command-line parameters.

Getting ready

To go through this recipe we need the user shell implemented. Follow the entire recipe Building and running a shell.

We will also need a sample CSV file from which to import records. Create a file named users.csv and place it in a directory of your choice (for example, in the application's app/tmp directory) with the following contents:

"john","John","Doe" "jane","Jane","Doe" "mark","Mark","Doe" "mathew","Mathew","Doe" ...

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