Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
A Pokemon Crash Course on CouchDB
Aug 12, 2016 @ 10:02:56

The SitePoint PHP blog has a new tutorial posted giving you a "Pokemon Crash Course" on CouchDB, the popular NoSQL database. The "Pokemon" part comes in related to the data the tutorial uses to show you common operations and the use of a PHP interface to perform them.

In this tutorial, we’ll walk through working with CouchDB, a NoSQL database from Apache. This tutorial will focus more on the practical side, so we won’t cover what CouchDB is good for, how to install it, why use it, etc. We’ll focus on how to perform database operations through CouchDB’s HTTP API and how to work with it in PHP, laying the foundation for future, more complex posts.

The article is then broken up into different sections by operation, starting with the use of the CouchDB database via a console then via PHP:

  • Creating a Database
  • Talking to the HTTP API
  • Creating New Documents
  • Bulk Insert
  • Retrieving Documents
  • Updating Documents
  • Working with PHP

Each section includes code snippets and (where relevant) screenshots of the results to help you ensure you're on the right track.

tagged: tutorial couchdb pokemon data introduction crud library example

Link: https://www.sitepoint.com/a-pokemon-crash-course-on-couchdb/

IBM Developer Blog:
Get Started With CouchDB Using PHP and Guzzle
Jul 28, 2016 @ 13:07:48

On the IBM Developer Blog they've posted a new article from Lorna Mitchell helping you get started with CouchDB and Guzzle, making use of this popular HTTP client package to interface with CouchDB's HTTP interface quickly and easily.

In today’s post, we’ll look at how we can use CouchDB in our PHP applications, using the excellent PHP HTTP library Guzzle. Guzzle is a modern, PSR-7 compliant object-oriented PHP library that handles all aspects of HTTP in a correct and — importantly, a scalable — way. So it’s a great way to add any HTTP-interfaced services into your application (PHP 5.5 and later, does support PHP 7).

She then starts off with the installation of Guzzle via Composer and some sample code to make the initial connection to the CouchDB server (either local or remote). With the connection up and working and a "welcome" banner returned, she shows some simple operations like:

  • getting a list of all databases
  • creating a new database
  • inserting and selecting data
  • updating and deleting data

Code is provided for each of these and, thankfully, Guzzle makes it a pretty simple process and handles most of the heavy lifting on the HTTP requests for you.

tagged: couchdb guzzle introduction database http install connect crud

Link: https://developer.ibm.com/clouddataservices/2016/07/27/get-started-with-couchdb-php-guzzle/

Thomas Hunter:
CouchDB and PHP Web Development (Book Review)
Sep 26, 2012 @ 10:20:18

Thomas Hunter has posted a (nice long) book review of the Packt Publishing book "CouchDB and PHP Web Development" to his site.

When I first picked up this book, I was expecting a boring, text-book approach to code examples for PHP talking with CouchDB. Boy was I wrong. What I found was a book that has you build a complete working application. And by complete, I mean you’ll add the Twitter Bootstrap framework and it will be sexy.

He mentions parts of the app you'll create - a PHP framework, 3rd party libraries, working with git/github - and goes through the sections of the book, talking about good and bad points along the way. Chapters cover things like: an introduction to NoSQL, REST/HTTP verbs, installation/config of CouchDB, using version control and deploying the app using the PHPFog PaaS hosting.

tagged: couchdb development bookreview packt introduction


Gonzalo Ayuso:
Book review: CouchDB and PHP Web Development
Aug 08, 2012 @ 08:16:48

Gonzalo Ayuso has posted a book review of a Packt Publishing book "CouchDB and PHP Web Development":

Finally the new Book “CouchDB and PHP Web Development” written by Tim Juravich is ready an in my hands. It was my first experience as technical reviewer. The author contacted me by email and the editor sent me book chapters to review. Basically I gave my opinion, I test the code and I hunt for bugs. It was a great experience. Now is really cool to see the book in my hands.

Overall, he gives it a positive review (for a beginner level book) and points out a few things that can help make the reading experience better, like the "Time for Action" sections. He also was happy with the author's choice of using the Twitter Bootstrap for the interface of the sample application.

tagged: bookreview couchdb packt development


Ibuildings techPortal:
DPC Radio: Distributed Couch Apps - Embracing eventual consistency
Nov 21, 2011 @ 12:12:00

On the Ibuildings techPortal today they've posted the latest episode of their DPC Radio series of podcasts, recordings of sessions from this year's Dutch PHP Conference. In this new episode they share the presentation by Kore Nordmann "Distributed Couch Apps - Embracing eventual consistency".

CouchDB is a prominent representative of the NoSQL movement. Using its integrated web server and eventual consistent replication you can not only distribute data, but also full application code. This even works for clients which are not always connected to the internet, like e.g. mobile devices. This session gives you an insight Couch apps, their beauty and pitfalls.

You can either listen via the in-page player, by downloading the mp3 or by subscribing to their feed. You can find his slides over on talks.qafoo.com.

tagged: podcast embracing distributed couchdb application dpc11 dpcradio


The era of Object-Document Mapping
Jul 08, 2011 @ 11:45:46

On the PHP on Windows section of DZone.com today Giorgio Sironi has posted about a different sort of object mapping than is usually thought of with databases - object-document mapping.

The Data Mapper pattern is a mechanism for persistence where the application model and the data source have no dependencies between each other. [...] But everytime we talk about the Data Mapper pattern, we assume there is a relational database on the other side of the persistence boundary. We always save objects; we always map them to MySQL or Postgres tables; but it's not mandatory.

He talks about two projects, MongoDb_ODM and CouchDb_ODM, that the Doctrine project is working on to help make working with document-driven databases as simple as the usual ORMs. He includes a brief code snippet showing how the feature will work (hint: a namespace of Document instead of Entity). He lists some of the features - including the usual ORM capabilities, support for collections, cascade of persistence - and where you can get the latest code for it (from github and PEAR

tagged: object document mapping doctrine mongodb couchdb


Using a stream wrapper to access CouchDb attachments with PHP
Apr 28, 2011 @ 10:45:27

On DZone.com today there's a new post from Gonzalo Ayuso about using a stream wrapper to access CouchDb database directly from PHP (via a call to its local file).

Thanks to a comment in my last post (many thanks Benjamin) I’ve discovered that it’s possible to create a stream wrapper in PHP (I thought it was only available with a C extension). It’s pretty straightforward to create the wrapper. Of course it’s only an approach. We can create more functionality to our stram wrapper but at least this example meets my needs.

His wrapper uses a client from his Nov framework to open the stream to the given path and gives read and write methods to work with the data inside the database. Code for the wrapper class is included as well as a bit of example code showing how it can be used with the custom stream protocol. You can find the complete code here.

tagged: couchdb stream wrapper database tutorial


Ibuildings techPortal:
DPCRadio: Embracing Constraints with CouchDB
Mar 23, 2011 @ 12:12:25

On the Ibuildings techPortal today they've posted the latest webcast in their "DPCRadio" series as recorded at last year's Dutch PHP Conference. In this latest episode they share David Zuelke's talk Embracing Constraints with CouchDB.

There has been a lot of buzz lately about the NoSQL movement in general and CouchDB in particular. For people who are used to relational databases, a lot of CouchDB's limitations look like severe disadvantages; these constraints however can also be great opportunities. This talk will give an overview of CouchDB and then focus on embracing the system's constraints to build better products.

You can either listen in-page or download the mp3 to get this latest episode. If you'd like to follow along with his slides, you can find them on SlideShare.

tagged: constraint couchdb dpcradio dpc10 session


Zend Developer Zone:
Getting started with CouchDB : meet PHP on Couch
Sep 10, 2010 @ 11:23:56

On the Zend Developer Zone today Michael Bailey has posted an introduction to CouchDb including some sample code (in a download) and a look at the basics of using the database itself.

I will not detail the installation of the CouchDB server, the wiki got enough details. For the rest of this article I will assume that we have a running CouchDB server waiting for our queries on couch.example.com on port 5984 (the default CouchDB port). Setting up PHP on Couch is not really complicated : just download it on github.com, extract the archive : the interesting bits are in the lib folder.

He starts with some of the key terms you'll need on the CouchDb side (like JSON, documents, _id and _rev) followed by the interaction between PHP and the database - creating a database, storing a document, using the document object mapper and working with views.

tagged: couchdb tutorial introduction phponcouch


Gonzalo Ayuso's Blog:
Using a stream wrapper to access CouchDb attachments with PHP
Sep 06, 2010 @ 08:15:22

In his continuing look at using CouchDb as a file system, Gonzalo Ayuso has posted this third part in the group of articles about using streams to connect your scripts to the database instance.

I'm still working in my filesystem with CouchDb. After creating a library to enable working with PHP and CouchDB (see the post here), and after using Monkey Patching to override standard PHP's filesystem functions. I've created another solution now. Thanks to a comment in my last post (many thanks Benjamin) I've discovered that it's possible to create a stream wrapper in PHP (I thought it was only available with a C extension).

He includes the code for the stream connection wrapper, a pretty simple script that parses the string it's given and opens a read/write stream to the source. There's also a "url_stat" method that will return to you the size of the stream in bytes. Then you just register the wrapper and go about your normal file system calls to use the CouchDb directly.

tagged: couchdb stream wrapper attachment tutorial