© Paul Redmond 2016

Paul Redmond, Lumen Programming Guide, 10.1007/978-1-4842-2187-7_8

8. Validation

Paul Redmond

(1)Phoenix, Arizona, USA

Your /books API is going smoothly up to this point, but your tests and controllers assume that good data is being submitted. Your application doesn’t protect against bad data (and empty data) being saved to the database; specifically, the BooksController@store and BooksController@update methods happily save bad data.

You will focus your efforts on validating data submitted to the /books API using the validation ( https://lumen.laravel.com/docs/5.2/validation ) tools provided by Lumen. You will write tests for your validation logic; this will provide you with a good foundation of how write validation tests in your ...

Get Lumen Programming Guide: Writing PHP Microservices, REST and Web Service APIs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.