Validation

    Lumen provides several different approaches to validate your application's incoming data. By default, Lumen's base controller class uses a trait which provides a convenient method to validate incoming HTTP request with a variety of powerful validation rules.

    Differences From Laravel

    Form Requests

    Form requests are not supported by Lumen. If you would like to use form requests, you should use the full Laravel framework.

    The $this->validate Method

    Unlike Laravel, Lumen provides access to the method from within Route closures:

    The $errors View Variable

    Lumen does not support sessions out of the box, so the view variable that is available in every view in Laravel is not available in Lumen. Should validation fail, the $this->validate helper will throw with embedded JSON response that includes all relevant error messages. If you are not building a stateless API that solely sends JSON responses, you should use the full Laravel framework.