2017 © Pedro Peláez
 

symfony-bundle couchbase-bundle

Makes it easier to handle couchbases design-documents in symfony2

image

simonsimcity/couchbase-bundle

Makes it easier to handle couchbases design-documents in symfony2

  • Monday, March 13, 2017
  • by SimonSimCity
  • Repository
  • 2 Watchers
  • 5 Stars
  • 1,325 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 9 Versions
  • 0 % Grown

The README.md

CouchbaseBundle

This bundle creates a Symfony2 integration for Couchbase. It currently adds commands to make it easier to automate import and export of design documents, stored in Couchbase and adds all Couchbase actions to the timeline in the Symfony2 profiler., (*1)

This bundle requires a specific version of the php-couchbase extension:, (*2)

PECL version CouchbaseBundle version
2.2.x 2.3.x
2.1.0 2.2.0
2.0.7 <= 2.1.1

Installation

Require simonsimcity/couchbase-bundle into your composer.json file:, (*3)

``` json { "require": { "simonsimcity/couchbase-bundle": "dev-master" } }, (*4)


Register the bundle in your Kernel: ```php <?php // app/AppKernel.php public function registerBundles() { $bundles = array( // ... new Simonsimcity\CouchbaseBundle\SimonsimcityCouchbaseBundle(), // ... ); }

To configure the couchbase-cluster, you want to use in your application, please adjust the settings for the extension as needed. Here's a sample-configuration for two buckets (foo and bar) on a local cluster (the cluster available as a service called couchbase.cluster.main) by the service names couchbase.bucket.main_foo and couchbase.bucket.bar, where the second bucket is secured by the password 123:, (*5)

simonsimcity_couchbase:
    cluster:
        main:
            dsn: http://127.0.0.1/
            username: root
            password: foo

            buckets:
                main_foo:
                    name: foo
                bar:
                    name: bar
                    password: 123

Using commands

You should see a couple of new methods in your symfony console:, (*6)

  • couchbase:export-ddoc - to export design-documents, stored in your couchbase-cluster, to files
  • couchbase:import-ddoc - to import design-documents, saved as file, into your couchbase-bucket
  • couchbase:export-docs - to export couchbase documents, saved in your couchbase-bucket as files
  • couchbase:import-docs - to import couchbase documents, saved as file, into your couchbase-bucket

When importing documents from the filesystem to the database, it additionally checks if the folder, you defined, also contains a folder having the same name as your environment. If found, the documents in there are imported as well. If the name of the folder for design-documents contains the characters {connection}, they are replaced by the name of the selected couchbase-connection., (*7)

More to come ..., (*8)

Setup, (*9)

In order to use the command couchbase:import-docs, you first have to create a view called get_all_docs in a document called sf2_couchbase_bundle whose map-function looks just like this:, (*10)

function (doc, meta) {
  emit(meta.id, null);
}

Example usage, (*11)

app/console couchbase:export-ddoc foo

Will save all design-documents, found in the couchbase-definition foo, to the folder app/Resouces/foo/ in files having the file-extension .ddoc, (*12)

app/console couchbase:import-ddoc -e test foo

Will import all files found in app/Resouces/foo/\*.ddoc and app/Resouces/foo/test/\*.ddoc. My recommendation is to create a file called sf2_couchbase_bundle.ddoc in the test folder so you'll always have that view available in your test environment., (*13)

app/console couchbase:export-docs foo data/

Will export all documents of your foo bucket to app/data/, (*14)

app/console couchbase:import-docs foo data/

Will import all files, having the extension .json into your defined foo couchbase-bucket, (*15)

Using the profiler for Couchbase

You can activate the stopwatch for every Couchbase-call by adding the following lines to your configuration:, (*16)

simonsimcity_couchbase:
    profiler_enabled: true

My personal recommendation is to add these lines to your config_dev.yml file., (*17)

The Versions

13/03 2017

dev-master

9999999-dev

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

13/03 2017

2.3.2

2.3.2.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

13/03 2017

2.3.1

2.3.1.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

09/01 2017

2.3.0

2.3.0.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

09/01 2017

2.2.0

2.2.0.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

08/01 2017

2.1.1

2.1.1.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

28/04 2016

2.1.0

2.1.0.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

27/11 2015

2.0.0

2.0.0.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document

19/08 2014

1.0

1.0.0.0

Makes it easier to handle couchbases design-documents in symfony2

  Sources   Download

MIT

The Requires

 

by Simon Schick

couchbase design document