![]()
CouchDB and PHP Web Development Beginner's Guide
Table of Contents
CouchDB and PHP Web Development Beginner's Guide
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
Time for action β heading
What just happened?
Pop quiz β heading
Have a go hero β heading
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
1. Introduction to CouchDB
The NoSQL database evolution
What makes NoSQL different
Classification of NoSQL databases
CAP theorem
ACID
So what does all of that mean?
Advantages of NoSQL databases
Negatives of NoSQL databases
When you should use NoSQL databases
When you should avoid NoSQL databases
Introduction to CouchDB
The history of CouchDB
Defining CouchDB
Summary
2. Setting up your Development Environment
Operating systems
Windows
Installing Apache and PHP
Installing Git
Installing CouchDB
Linux
Installing Apache and PHP
Installing Git
Installing CouchDB
Setting up your web development environment on Mac OS X
Terminal
Time for action β using Terminal to show hidden files
What just happened?
Text editor
Apache
Web browser
Time for action β opening your web browser
What just happened?
PHP
Time for action β checking your PHP version
What just happened?
Time for action β making sure that Apache can connect to PHP
What just happened?
Time for action β creating a quick info page
What just happened?
Fine tuning Apache
Time for action β further configuration of Apache
What just happened?
Our web development setup is complete!
Installing CouchDB
Homebrew
Time for action β installing Homebrew
What just happened?
Time for action β installing CouchDB
What just happened?
Checking that our setup is complete
Starting CouchDB
Time for action β checking that CouchDB is running
What just happened?
Running CouchDB as a background process
Installing version control
Git
Time for action β installing and configuring Git
What just happened?
Did you have any problems?
Pop quiz
Summary
3. Getting Started with CouchDB and Futon
What is CouchDB?
Database server
Documents
Example of a CouchDB document
JSON format
Key-value storage
Reserved fields
RESTful JSON API
Time for action β getting a list of all databases in CouchDB
What just happened?
Time for action β creating new databases in CouchDB
What just happened?
Time for action β deleting a database In CouchDB
What just happened?
Time for action β creating a CouchDB document
What just happened?
Futon
Time for action β updating a document in Futon
What just happened?
Time for action β creating a document in Futon
What just happened?
Security
Time for action β taking CouchDB out of Admin Party
What just happened?
Time for action β anonymously accessing the _users database
What just happened?
Time for action β securing the _users database
What just happened?
Time for action β checking to make sure the database is secure
What just happened?
Time for action β accessing a database with security enabled
What just happened?
Pop quiz
Summary
4. Starting your Application
What we'll build in this book
Bones
Project setup
Time for action β creating the directories for Verge
What just happened?
Source control with Git
Time for action β initializing a Git repository
What just happened?
Implementing basic routing
Time for action β creating our first file: index.php
What just happened?
.htaccess files
Time for action β creating the .htaccess file
What just happened?
Hacking together URLs
Creating the skeleton of Bones
Time for action β hooking up our application to Bones
What just happened?
Using Bones to handle requests
Time for action β creating the class structure of Bones
What just happened?
Accessing the route
Time for action β creating functions to access the route on Bones creation
What just happened?
Matching URLs
Time for action β creating the register function to match routes
What just happened?
Calling the register function from our application
Time for action β creating a get function in our Bones class
What just happened?
Adding routes to our application
Time for action β creating routes for us to test against Bones
What just happened?
Testing it out!
Adding changes to Git
Handling layouts and views
Using Bones to support views and layouts
Time for action β using constants to get the location of the working directory
What just happened?
Time for action β allowing Bones to store variables and the content path
What just happened?
Time for action β allowing our application to display a view by calling it in index.php
What just happened?
Time for action β creating a simple layout file
What just happened?
Adding views to our application
Time for action β rendering views inside of our routes
What just happened?
Time for action β creating views
What just happened?
Adding changes to Git
Adding support for other HTTP methods
Time for action β retrieving the HTTP method used in a request
What just happened?
Time for action β al...