Book Image

Learning Laravel 4 Application Development

By : Hardik Dangar
Book Image

Learning Laravel 4 Application Development

By: Hardik Dangar

Overview of this book

<p>Laravel 4 is a clean and classy framework for PHP web development. It attempts to ease the development of web applications by simplifying the common tasks required in the majority of web projects, such as authentication, routing, sessions, and caching.</p> <p>"Learning Laravel 4 Application Development" uses a step-by-step approach to teach you how to build real-world web applications. You will learn how to create a web application from scratch as well as how to create and use packages to build reusable components to be used in your projects.</p> <p>This book begins by familiarizing you with MVC concepts as well as the Laravel 4 framework. From there, it moves on to the creation of the frontend and backend of your web application. As you progress through the book, you will learn how you can authenticate users as well as develop RESTful APIs. You will also learn how to configure, optimize, and secure your applications. Lastly, it teaches you how to deploy your applications using different approaches like Git, FTP, and SSH.</p> <p>Laravel 4 Application Development will teach you everything you need to know to create accessible real-world web applications quickly and efficiently.</p>
Table of Contents (18 chapters)
Learning Laravel 4 Application Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
4
Building a Real-life Application with Laravel 4 – The Foldagram
11
Creating a Workflow and Useful Laravel Packages and Tools
Index

Preface

This book is about Laravel 4 and its features, and how to use them in real-world projects.

This book will walk you through every single step you need to learn as a beginner to develop Laravel applications with project examples for each. I have used a real-world project that I have developed in Laravel 4 for one of my clients as a sample project to help you go through each process of project development in Laravel 4.

This book covers most of the things you should know when you are developing a project in Laravel 4.

What this book covers

Chapter 1, Welcome to the World of Laravel, introduces the basic MVC concepts and Laravel 4 to you and explains why you should develop your next project in Laravel 4.

Chapter 2, Let's Begin the Journey, explains how to install Laravel 4 and the configuration settings you may need to change.

Chapter 3, Creating a Simple CRUD Application in Hours, will take you through a 360-degree spin ride of how awesome Laravel is for simple CRUD applications and how you can build them with Laravel 4 in hours instead of days.

Chapter 4, Building a Real-life Application with Laravel 4 – The Foldagram, explains how to start a real-world project in Laravel 4. It starts with the requirements. It also explains how you can build migrations in Laravel to manage your database in versions. Then, at the end of the chapter, it explains how to build the frontend of your project as well as some of the frontend features of the project.

Chapter 5, Creating a Cart Package for Our Application, explains how Laravel 4 handles packages. Then, it includes the core concepts of the Laravel framework for us to understand the relationship between packages and the IoC container and learn how we can create packages. Then, at the end, we will see how to build our own Cart package, which can be used in our project as well as other projects.

Chapter 6, User Management and Payment Gateway Integration, explains how to build user registration, login, and dashboard pages for our project. You will learn how to authenticate users and to integrate the cart with the payment gateway. You will also learn how to utilize existing Laravel packages, and how to find them and integrate them in your projects.

Chapter 7, The Admin Section, explains how to build the administration area of our project. You will learn how to build the backend foundation of the project and then the features of our project, such as managing orders, exporting orders, adding credit to users, managing users, resetting passwords, and blocking users.

Chapter 8, Building a RESTful API with Laravel – Store Locator, explains how we can create RESTful applications with Laravel and also how to build an Ajax-powered, one-page store locator application based on the RESTful API built with Laravel.

Chapter 9, Optimizing and Securing Our Applications, explains how you can optimize your applications with the Laravel profiler and how to add security layers in Your application.

Chapter 10, Deploying Laravel Applications, explains how to deploy Laravel applications. It teaches you how to deploy application with FTP or SSH and how to use Git to manage automatic deployments.

Chapter 11, Creating a Workflow and Useful Laravel Packages and Tools, explains some of the useful packages that can be used to create web applications rapidly in Laravel. It also gives some tips on the tools and workflows that will make your life easy as a developer.

What you need for this book

Throughout this book, I have assumed that you have the following programs/packages installed:

  • Composer

  • PHP 5.3.7 or later

  • MCrypt PHP extension

  • One of the databases, such as MySQL, MSSQL, and PGSQL

If you don't have them, don't worry. Chapter 2, Let's Begin the Journey of this book will guide you through installing them.

Who this book is for

This book is for developers who are new to the Laravel framework as well as developers who want to explore the new breed of Laravel 4, which has been completely redeveloped by Taylor Otwell. You will need to know the basics of PHP and MySQL as well as some basic concepts about object-oriented programming.

If you are tired of dealing with the old way of developing PHP applications and want to use Laravel 4 to manage your project and learn how to do it step-by-step, then this book is for you.

Conventions

In this book, you will find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "You can define RESTful controllers via Laravel 4, and Controllers can have a predefined method to receive a request via GET, PUT, DELETE, POST, and UPDATE."

A block of code is set as follows:

$env = $app->detectEnvironment(array(
   'local' => array('your-machine-name'),
   'production' => array('example.com'),
));

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

return array(
      'connections' => array(
               'mysql' => array(
               'driver'    => 'mysql',
               'host'      => 'db.example.com',
               'database'  => 'myapp',
               'username'  => 'myappuser',
               'password'  => 'myapppassword',
               'charset'   => 'utf8',
               'collation' => 'utf8_unicode_ci',
               'prefix'    => '',
            ),
      )
);

Any command-line input or output is written as follows:

# php artisan routes

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "Also, we have an Add User button which will allow the user to add a new user into the system."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to , and mention the book title via the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded on our website, or added to any list of existing errata, under the Errata section of that title. Any existing errata can be viewed by selecting your title from http://www.packtpub.com/support.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at if you are having a problem with any aspect of the book, and we will do our best to address it.