Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Laravel 5 Essentials
Laravel 5 Essentials

Laravel 5 Essentials: Explore the fundamentals of Laravel, one of the most expressive and robust PHP frameworks available

eBook
€8.99 €19.99
Paperback
€24.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Laravel 5 Essentials

Chapter 2. Setting Up a Development Environment

Laravel is more than just a framework: a whole ecosystem and toolset has been developed around it to make building PHP applications faster and more enjoyable. These tools are entirely opt-in and the knowledge of them is not necessary to use and build projects in Laravel, but they do go hand-in-hand with the framework, so it's worth covering.

In this chapter, we will cover the following topics:

  • Meeting Composer, a dependency manager
  • Introduction to Homestead, and using it to manage Laravel projects

Meeting Composer

In the previous chapter, you discovered that Laravel is built on top of several third-party packages. Rather than including these external dependencies in its own source code, Laravel uses a dependency manager called Composer to download them and keep them up to date. Since Laravel is made up of multiple packages, they too are downloaded and installed each time you create a new Laravel project.

Strongly inspired by popular dependency managers in other languages, such as Ruby's Bundler or Node.js's Node Package Manager (npm), Composer brings these features to PHP and has quickly become the de facto dependency manager in PHP.

A few years ago, you may have used PHP Extension and Application Repository (PEAR) to download libraries. PEAR differs from Composer, in that PEAR would install packages on a system-level basis, whereas a dependency manager, such as Composer, installs them on a project-level basis. With PEAR, you could only have one version of a package installed...

Working with the command line

If you are just getting started with web development, you might not be completely familiar with the command-line interface (CLI). Working with Composer, virtual machines, and Homestead, and later on with Artisan, Laravel's CLI utility, will require some interaction with it.

Here is how you can start with CLI:

  1. On Windows, look for the Command Prompt program. If you cannot find it, just navigate to Start | Run and type in cmd.exe.
  2. On Mac OS X, CLI is called Terminal, and it can be found at /Applications/Utilities.
  3. On Linux, depending on your distribution of Linux, it will be called Terminal or Konsole, but if you are running Linux, you are probably already familiar with it.

You do not need to have any advanced command-line skills to get through this book and build applications with Laravel. You will, however, need to be able to navigate to the right directory in your file system before running commands. To do this, just enter the cd command, followed by the path...

Meet Homestead

If you wanted to develop PHP applications on your personal computer, you needed to have a web server installed and running locally. PHP is installed to interpret your scripts, and other utilities your website may need, such as working with a database. Your website or web application may even have a requirement for other services such as Memcached or Redis, which are popular caching systems. This saw the rise of utilities such as WampServer and MAMP to create environments for developing dynamic websites without getting connected to the Internet, but these required configuring.

Building on from installed environments like these, the recommended practice for developing dynamic websites and applications is to use virtual machines (VMs). These allow you to emulate your production web server's setup on your local machine. You can also use differently configured VMs for different projects—with a WAMP- or MAMP-like setup, every project had to use the same version of PHP...

Creating a new Laravel application

With Homestead set up, you now have a development environment to build Laravel applications that can easily be removed at a later date without disturbing your machine. You must be itching to get started with Laravel, so here we go!

In the next chapter, we will go through building a simple application in Laravel from start to finish. So now, we will prepare this project in Homestead:

  1. First, check whether Homestead is running by using the following command:
    > $ homestead status
    
  2. If the status is anything other than running, bring it up with the homestead reload command. We now need to add our site. It will be a browsable database of cat profiles, so let's call it "Furbook" and give it the fictional domain name of furbook.com.
  3. We can set this up in Homestead by editing the configuration file and adding the following mappings:
    sites:
        - map: dev.furbook.com
          to: /home/vagrant/Code/furbook.com/public
    databases:
        - furbook
  4. Run $ homestead...

Summary

In this chapter, we have begun working with the command line. We've installed Composer and looked at how a dependency manager such as Composer aids development by utilizing prebuilt packages in our projects (of which the Laravel framework is one). We've looked at the concept of virtual machines for developing in, and taken a look and installed the official Laravel VM: Homestead.

The next chapter is where the fun begins! Now that we have a complete development environment set up and a fresh Laravel application created, we will go through the different steps involved in creating a complete Laravel application.

Left arrow icon Right arrow icon
Download code icon Download Code

Description

This book is intended for PHP web developers who have an interest in Laravel and who know the basics of the framework in theory, but don't really know how to use it in practice. No experience of using frameworks is required, but it is assumed you are at least familiar with building dynamic websites in PHP already.

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Apr 28, 2015
Length: 144 pages
Edition : 1st
Language : English
ISBN-13 : 9781785283291
Category :
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Apr 28, 2015
Length: 144 pages
Edition : 1st
Language : English
ISBN-13 : 9781785283291
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 66.98
Laravel 5 Essentials
€24.99
Laravel 5.x Cookbook
€41.99
Total 66.98 Stars icon
Banner background image

Table of Contents

9 Chapters
1. An Introduction to Laravel Chevron down icon Chevron up icon
2. Setting Up a Development Environment Chevron down icon Chevron up icon
3. Your First Application Chevron down icon Chevron up icon
4. Eloquent ORM Chevron down icon Chevron up icon
5. Testing – It's Easier Than You Think Chevron down icon Chevron up icon
6. A Command-line Companion Called Artisan Chevron down icon Chevron up icon
7. Authentication and Security Chevron down icon Chevron up icon
A. An Arsenal of Tools Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Half star icon Empty star icon 3.7
(13 Ratings)
5 star 23.1%
4 star 38.5%
3 star 23.1%
2 star 15.4%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Kaley36 Aug 10, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Great Book, A nice and easy way to get started
Amazon Verified review Amazon
Prashant Oct 27, 2022
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is very comprehensive and covers almost everything you need to know to get started with Laravel. The author also provides good examples to illustrate various concepts.
Amazon Verified review Amazon
Amazon Customer Dec 29, 2016
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Good book to initiate study about Laravel PHP framework. With this book I could to start a project from scratch in few days of reading. I recommend it to someone who wants to start with this framework.
Amazon Verified review Amazon
JW Jul 16, 2016
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Although slightly dated, this book gives a really good introduction to how a basic MVC application can be created using Laravel 5, as well as a chapter on Eloquent ORM and testing.
Amazon Verified review Amazon
Daniel Gomez Jul 22, 2015
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
Its a good starter book, It help you to start a CRUD project but if you are going to do some more complex stuff, you will need to research a lot. beside that the examples are good and it is easy to follow.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.