Book Image

CouchDB and PHP Web Development Beginner's Guide

By : Tim Juravich
Book Image

CouchDB and PHP Web Development Beginner's Guide

By: Tim Juravich

Overview of this book

CouchDB is a NoSQL database which is making waves in the development world. It's the tool of choice for many PHP developers so they need to understand the robust features of CouchDB and the tools that are available to them.CouchDB and PHP Web Development Beginner's Guide will teach you the basics and fundamentals of using CouchDB within a project. You will learn how to build an application from beginning to end, learning the difference between the "quick way"ù to do things, and the "right way"ù by looking through a variety of code examples and real world scenarios. You will start with a walkthrough of setting up a sound development environment and then learn to create a variety of documents manually and programmatically. You will also learn how to manage their source control with Git and keep track of their progress. With each new concept, such as adding users and posts to your application, the author will take you through code step-by-step and explain how to use CouchDB's robust features. Finally, you will learn how to easily deploy your application and how to use simple replication to scale your application.
Table of Contents (17 chapters)
CouchDB and PHP Web Development Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
4
Starting your Application

Preface

PHP and CouchDB Web Development will teach you the fundamentals of combining CouchDB and PHP to create a full application from conception to deployment. This book will direct you in developing a basic social network, while guiding you through some of the common pitfalls that are frequently associated with NoSQL databases.

What this book covers

Chapter 1, Introduction to CouchDB, provides a quick definition of NoSQL and an overview of CouchDB.

Chapter 2, Setting up your Development Environment, sets up your computer for developing an application with PHP and CouchDB.

Chapter 3, Getting Started with CouchDB and Futon, defines CouchDB documents and shows how to manage them both from the command-line and within Futon — CouchDB's built-in administration utility.

Chapter 4, Starting your Application, creates a simple PHP framework to house your application and publishes this code to GitHub.

Chapter 5, Connecting your Application to CouchDB, connects your application to CouchDB using a variety of methods, and ultimately picks the right solution for your application.

Chapter 6, Modeling Users, creates users within your application and handles document creation and authentication with CouchDB.

Chapter 7, User Profiles and Modeling Posts, perfects your user profile using Bootstrap and posts content to CouchDB.

Chapter 8, Using Design Documents for Views and Validation, explores CouchDB's exclusive use of Design Documents to improve the quality of your application.

Chapter 9, Adding Bells and Whistles to your Application, leverages existing tools to simplify and improve your application.

Chapter 10, Deploying your Application, shows your application to the world, and teaches you how to launch your application and database using a variety of Cloud services.

Bonus Chapter, Replicating your Data, finds out how to use CouchDB's replication system to scale your application as it grows.

You can download the Bonus Chapter from http://www.packtpub.com/sites/default/files/downloads/Replicating_your_Data.pdf.

What you need for this book

You'll need a modern computer with Mac OSX. Chapter 1, Introduction to CouchDB, will provide the setup instructions for Linux and Windows machines, and the code written in this book will work on any machine. However, the majority of the command-line statements and applications that we'll use in this book are Mac OSX-specific.

Who this book is for

This book is for beginners and intermediate PHP developers, who are interested in using CouchDB development in their projects. Advanced PHP developers will appreciate the familiarity of the PHP architecture, and can easily learn how to incorporate CouchDB into their existing development experiences.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action — heading

  1. 1. Action 1

  2. 2. Action 2

  3. 3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz — heading

These are short multiple choice questions intended to help you test your own understanding.

Have a go hero — heading

These set practical challenges and give you ideas for experimenting with what you have learned.

You will also 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 are shown as follows: " It's difficult to standardize the install methods for Linux, because there are many different flavors and configurations."

A block of code is set as follows:

<Directory />
Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all
</Directory>

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

<Directory />
Options FollowSymLinks
AllowOverride All

Order deny,allow
Allow from all
</Directory>

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

sudo apt-get install php5 php5-dev libapache2-mod-php5 php5-curl php5-mcrypt

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:"Start by opening Terminal".

Note

Warnings or important notes appear in a box like this.

Note

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 through 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/support, 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 to our website, or added to any list of existing errata, under the Errata section of that title.

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.