toiine / couchbasebundle
Symfony2 bundle to manipulate Couchbase Documents.
Installs: 1 372
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 4
Forks: 3
Open Issues: 1
Type:symfony-bundle
Requires
- php: >=5.3.2
- jms/serializer: 0.14.*@dev
- symfony/config: 2.3.x-dev
- symfony/dependency-injection: 2.3.x-dev
- symfony/http-kernel: 2.3.x-dev
Requires (Dev)
- phake/phake: v1.0.3
This package is not auto-updated.
Last update: 2025-06-22 03:03:33 UTC
README
Symfony2 bundle to manipulate Couchbase Documents.
Installation
Installing the bundle via packagist is the quickest and simplest method of installing the bundle. Here are the steps:
Step 1: Composer require
$ php composer.phar require "toiine/couchbasebundle":"dev-master"
Step 2: Enable the bundle in the kernel
<?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Toiine\CouchbaseBundle\ToiineCouchbaseBundle(), // ... ); }
Configuration
There is a sample configuration file in Resources/config/couchbase.yml.dist
connections: conn1: # default is "localhost" # host: # default is 8091 # port: username: admin password: admin bucket: default conn2: host: couchbase.tld port: 8092 username: couchbase password: cOuchb4s3 bucket: bucket2
Services
A compiler pass will generate services according to the configuration file
php app/console container:debug | grep couchbase
Service name | Class |
---|---|
toiine_couchbase.conn1 | Couchbase |
toiine_couchbase.conn2 | Couchbase |
You can use toiine_couchbase.<connectionName> services to manipulate you documents.
NB: documentation on other services will come soon.
Usage
<?php namespace Acme\HelloBundle\Controller; use Symfony\Component\HttpFoundation\Response; class DocController { public function getDocumentAction($key) { $couchbase = $this->get('toiine_couchbase.conn1'); // Get a doc from couchbase $doc = $couchbase->get($key); // Push a doc to couchbase $couchbase->set($key, $doc); // Delete a doc from couchbase $couchbase->delete($key); ... } }
TODO
- add a profiling panel in the web debug toolbar : see the calls and the time they took
- integrate Jms Serializer : manipulate Entities through Couchbase the same way as Doctrine EntityManager