Laravel Application Development Cookbook

Since Laravel is so versatile, one of the best learning routes is a cookbook. We’ve included lots of recipes and guidance on building web application, both simple and complex. It’s a pick & mix approach that works brilliantly.

Laravel Application Development Cookbook

Cookbook
Terry Matula

Since Laravel is so versatile, one of the best learning routes is a cookbook. We’ve included lots of recipes and guidance on building web application, both simple and complex. It’s a pick & mix approach that works brilliantly.
$26.99
$44.99
RRP $26.99
RRP $44.99
eBook
Print + eBook
$12.99 p/month

Want this title & more? Subscribe to PacktLib

Enjoy full and instant access to over 2000 books and videos – you’ll find everything you need to stay ahead of the curve and make sure you can always get the job done.
+ Collection
Free sample

Book Details

ISBN 139781782162827
Paperback272 pages

About This Book

  • Install and set up a Laravel application and then deploy and integrate third parties in your application
  • Create a secure authentication system and build a RESTful API
  • Build your own Composer Package and incorporate JavaScript and AJAX methods into Laravel

Who This Book Is For

The Laravel Application Development Cookbook is for PHP developers who are new to Laravel or development frameworks in general, as well as experienced Laravel developers looking to expand their knowledge. This book assumes that the reader has some familiarity with PHP.

Table of Contents

Chapter 1: Setting Up and Installing Laravel
Introduction
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
Chapter 2: Using Forms and Gathering Input
Introduction
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
Chapter 3: Authenticating Your Application
Introduction
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
Chapter 4: Storing and Using Data
Introduction
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
Chapter 5: Using Controllers and Routes for URLs and APIs
Introduction
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
Chapter 6: Displaying Your Views
Introduction
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
Chapter 7: Creating and Using Composer Packages
Introduction
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
Chapter 8: Using Ajax and jQuery
Introduction
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
Chapter 9: Using Security and Sessions Effectively
Introduction
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
Chapter 10: Testing and Debugging Your App
Introduction
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
Chapter 11: Deploying and Integrating Third-party Services into Your Application
Introduction
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

What You Will Learn

  • Set up a virtual host and development environment in Apache
  • Set up a user authentication system
  • Use the RESTful controllers
  • Debug and profile your application
  • Store and retrieve content from the cloud
  • Use the Artisan command-line tool
  • Integrate JavaScript and jQuery into your Laravel app
  • Write unit tests for Laravel

In Detail

When creating a web application, there are many PHP frameworks from which to choose. Some are very easy to set up, and some have a much steeper learning curve. Laravel offers both paths. You can do a quick installation and have your app up-and-running in no time, or you can use Laravel’s extensibility to create an advanced and fully-featured app.

Laravel Application Development Cookbook provides you with working code examples for many of the common problems that web developers face. In the process, it will also allow both new and existing Laravel users to expand their knowledge of the framework.

This book will walk you through all aspects of Laravel development. It begins with basic set up and installation procedures, and continues through more advanced use cases.

You will also learn about all the helpful features that Laravel provides to make your development quick and easy. For more advanced needs, you will also see how to utilize Laravel’s authentication features and how to create a RESTful API.

In the Laravel Application Development Cookbook, you will learn everything you need to know about a great PHP framework, with working code that will get you up-and-running in no time.

Authors

Table of Contents

Chapter 1: Setting Up and Installing Laravel
Introduction
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
Chapter 2: Using Forms and Gathering Input
Introduction
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
Chapter 3: Authenticating Your Application
Introduction
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
Chapter 4: Storing and Using Data
Introduction
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
Chapter 5: Using Controllers and Routes for URLs and APIs
Introduction
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
Chapter 6: Displaying Your Views
Introduction
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
Chapter 7: Creating and Using Composer Packages
Introduction
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
Chapter 8: Using Ajax and jQuery
Introduction
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
Chapter 9: Using Security and Sessions Effectively
Introduction
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
Chapter 10: Testing and Debugging Your App
Introduction
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
Chapter 11: Deploying and Integrating Third-party Services into Your Application
Introduction
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

Book Details

ISBN 139781782162827
Paperback272 pages
Read More