Laravel 5 Essentials
eBook - ePub

Laravel 5 Essentials

Martin Bean

Share book
  1. 144 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Laravel 5 Essentials

Martin Bean

Book details
Book preview
Table of contents
Citations

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Laravel 5 Essentials an online PDF/ePUB?
Yes, you can access Laravel 5 Essentials by Martin Bean in PDF and/or ePUB format, as well as other popular books in Computer Science & Programming in PHP. We have over one million books available in our catalogue for you to explore.

Information

Year
2015
ISBN
9781785283017

Laravel 5 Essentials


Table of Contents

Laravel 5 Essentials
Credits
About the Author
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why subscribe?
Free access for Packt account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. An Introduction to Laravel
The need for frameworks
The limitations of homemade tools
Laravel to the rescue
A new approach to developing PHP applications
A more robust HTTP foundation
Embracing PHP
Laravel's main features and sources of inspiration
Expressiveness and simplicity
Prettifying PHP
Responsibilities, naming, and conventions
Helping you become a better developer
Structure of a Laravel application
The service container and request lifecycle
Exploring Laravel
Changes in Version 5 from Version 4
Summary
2. Setting Up a Development Environment
Meeting Composer
Working with the command line
Meet Homestead
Installing Homestead
Everyday usage of Homestead
Adding additional websites
Connecting to your databases
Creating a new Laravel application
Summary
3. Your First Application
Planning our application
Entities, relationships, and attributes
The map of our application
Starting the application
Setting the application namespace
Writing the first routes
Restricting the route parameters
Handling HTTP exceptions
Performing redirections
Returning views
Preparing the database
Creating Eloquent models
Building the database schema
Seeding the database
Mastering Blade
Creating a master view
Back to the routes
The overview page
Displaying a cat's page
Route-model binding
Adding, editing, and deleting cats
Moving from simple routing to powerful controllers
Resource controllers
Summary
4. Eloquent ORM
Eloquent conventions
Retrieving data
Filtering records
Saving data
Mass assignment
Deleting data
Soft deletion
Including deleted models in results
Query scopes
Relationships
One-to-one
Many-to-many
Storing data in the pivot table
Has-many-through
Polymorphic relations
Many-to-many polymorphic relations
Model events
Registering event listeners
Model observers
Collections
Checking whether a key exists in a collection
Summary
5. Testing – It's Easier Than You Think
The benefits of testing
The anatomy of a test
Unit testing with PHPUnit
Defining what you expect with assertions
Preparing the scene and cleaning up objects
Expecting exceptions
Testing interdependent classes in isolation
End-to-end testing
Testing – batteries included
Framework assertions
Impersonating users
Testing with a database
Inspecting the rendered views
Summary
6. A Command-line Companion Called Artisan
Keeping up with the latest changes
Inspecting and interacting with your application
Fiddling with the internals
Turning the engine off
Fine-tuning your application
Caching routes
Generators
Rolling out your own Artisan commands
Creating the command
The anatomy of a command
Writing the command
Scheduling commands
Viewing the output of scheduled commands
Summary
7. Authentication and Security
Authenticating users
Creating the user model
Creating the necessary database schema
Authentication routes and views
Middleware
Validating user input
Form requests
Securing your application
Cross-site request forgery
Escaping content to prevent cross-site scripting (XSS)
Avoiding SQL injection
Using mass assignment with care
Cookies – secure by default
Forcing HTTPS when exchanging sensitive data
Summary
A. An Arsenal of Tools
Array helpers
The usage examples of array helpers
String and text manipulation
Boolean functions
Transformation functions
Inflection functions
Dealing with files
File uploads
Sending e-mails
Easier date and time handling with Carbon
Instantiating Carbon objects
Outputting user-friendly timestamps
Boolean methods
Carbon for Eloquent DateTime properties
Don't wait any longer with queues
Creating a command and pushing it onto the queue
Listening to a queue and executing jobs
Getting notified when a job fails
Queues without background processes
Where to go next?
Index

Laravel 5 Essentials

Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: April 2015
Production reference: 1240415
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78528-301-7
www.packtpub.com

Credits

Author
Martin Bean
Reviewers
Si Fleming
Michael Peacock
Brayan Laurindo Rastelli
Michele Somma
Commissioning Editor
Akram Hussain
Acquisition Editor
Reshma Raman
Content Development Editor
Mohammed Fahad
Technical Editor
Ankur Ghiye
Copy Editors
Merilyn Pereira
Laxmi Subramanian
Project Coordinator
Danuta Jones
Proofreaders
Safis Editing
Paul Hindle
Indexer
Monica Ajmera Mehta
Production Coordinator
Nilesh R. Mohite
Cover Work
Nilesh R. Mohite
2323__pe...

Table of contents