PacktLib: Laravel Application Development Cookbook

Laravel Application Development Cookbook


About the Author

About the Reviewers


Setting Up and Installing Laravel


Installing Laravel as a git submodule

Setting up a virtual host and development environment in Apache

Creating "clean" URLs

Configuring Laravel

Using Laravel with Sublime Text 2

Setting up your IDE to autocomplete Laravel's namespaces

Using Autoloader to map a class name to its file

Creating advanced Autoloaders with namespaces and directories

Using Forms and Gathering Input


Creating a simple form

Gathering form input to display on another page

Validating user input

Creating a file uploader

Validating a file upload

Creating a custom error message

Adding a honey pot to a form

Uploading an image using Redactor

Cropping an image with Jcrop

Creating an autocomplete text input

Making a CAPTCHA-style spam catcher

Authenticating Your Application


Setting up and configuring the Auth library

Creating an authentication system

Retrieving and updating user info after logging in

Restricting access to certain pages

Setting up OAuth with the HybridAuth package

Using OpenID for logins

Logging in using Facebook credentials

Logging in using Twitter credentials

Logging in using LinkedIn

Storing and Using Data


Creating data tables using migrations and schemas

Querying using raw SQL statements

Querying using Fluent

Querying using Eloquent ORM

Using automatic validation in models

Using advanced Eloquent and relationships

Creating a CRUD system

Importing a CSV using Eloquent

Using RSS as a data source

Using attributes to change table column names

Using a non-Eloquent ORM in Laravel

Using Controllers and Routes for URLs and APIs


Creating a basic controller

Creating a route using a closure

Creating a RESTful controller

Using advanced routing

Using a filter on the route

Using route groups

Building a RESTful API with routes

Using named routes

Using a subdomain in your route

Displaying Your Views


Creating and using a basic view

Passing data into a view

Loading a view into another view/nested views

Adding assets

Creating a view using Blade

Using TWIG templates

Utilizing advanced Blade usage

Creating localization of content

Creating menus in Laravel

Integrating with Bootstrap

Using named views and view composers

Creating and Using Composer Packages


Downloading and installing packages

Using the Generators package to set up an app

Creating a Composer package in Laravel

Adding your Composer package to Packagist

Adding a non-Packagist package to Composer

Creating a custom artisan command

Using Ajax and jQuery


Getting data from another page

Setting up a controller to return JSON data

Creating an Ajax search function

Creating and validating a user using Ajax

Filtering data based on checkbox selection

Making an Ajax newsletter sign-up box

Sending an e-mail using Laravel and jQuery

Creating a sortable table using jQuery and Laravel

Using Security and Sessions Effectively


Encrypting and decrypting data

Hashing passwords and other data

Using CSRF tokens and filters in forms

Using advanced validation in forms

Building a shopping cart

Using Redis to save sessions

Using basic sessions and cookies

Creating a secure API server

Testing and Debugging Your App


Setting up and configuring PHPUnit

Writing and running a test case

Using Mockery to test controllers

Writing acceptance tests using Codeception

Debugging and profiling your app

Deploying and Integrating Third-party Services into Your Application


Creating a queue and using Artisan to run it

Deploying a Laravel app to Pagoda Box

Using the Stripe payment gateway with Laravel

Doing a GeoIP lookup and setting custom routing

Gathering e-mail addresses and using them with a third-party e-mail service

Storing and retrieving cloud content from Amazon S3