Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Laravel 5.x Cookbook

You're reading from  Laravel 5.x Cookbook

Product type Book
Published in Sep 2016
Publisher Packt
ISBN-13 9781786462084
Pages 402 pages
Edition 1st Edition
Languages
Authors (2):
Terry Matula Terry Matula
Profile icon Terry Matula
Alfred Nutile Alfred Nutile
Profile icon Alfred Nutile
View More author details

Table of Contents (17) Chapters

Laravel 5.x Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
1. Setting Up and Installing Laravel 2. Using Composer Packages 3. Routing 4. Building Views and Adding Style 5. Working with Data 6. Adding Angular to Your App 7. Authentication, Security, and Subscriptions 8. Testing and Debugging Your Application 9. Adding Advanced Features to Your App 10. Deploying Your App Index

Making a provider


In the previous section, we used composer to pull in Guzzle, so we're ready to use it in our project. However, we'd rather not have to instantiate the Guzzle client manually every time we invoke it—hardcoding URLs and authentication and settings with each use. A service provider can help to centralize some of this configuration, and later, we will use service providers to help swap in a mock implementation for testing purposes.

Providers can also help us to avoid writing code that directly calls to a service, which is often a very helpful practice. For example, we may make BillingProvider that can use either Swipe or BrightTree as a billing service. BillingProvider allows us to easily switch between different implementations of the billing service.

Getting ready

Follow the steps in the Working with Composer install command and avoiding composer update section to pull in Guzzle, and start up your terminal.

How to do it...

The following steps will help you in making a provider...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}