albertborsos/yii2-couchbase

Couchbase component for Yii 2.0 Framework

Installs: 629

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 0

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2019-10-03 14:40 UTC

This package is auto-updated.

Last update: 2020-08-03 16:42:03 UTC


README

Build Status Coverage Status

Yii 2.0 Couchbase Component

Couchbase component for Yii 2.0 Framework

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist albertborsos/yii2-couchbase "*"

or add

"albertborsos/yii2-couchbase": "*"

to the require section of your composer.json file.

Usage

Create couchbase.ini:

extension=couchbase.so
; priority=30

To install couchbase to docker, add these lines to your Dockerfile.dev:

#install couchbase extension
RUN curl -O http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-6-amd64.deb
RUN dpkg -i couchbase-release-1.0-6-amd64.deb
RUN apt-get update && \
	    apt-get install -y --no-install-recommends \
	    libcouchbase-dev build-essential php-pear php-dev zlib1g-dev
RUN pecl install couchbase
ADD couchbase.ini /etc/php/7.3/mods-available/couchbase.ini
RUN phpenmod couchbase

For development use the following docker-compose image configuration

    cb:
        image: couchbase/server
        volumes:
            - ~/couchbase/cb:/opt/couchbase/var
        ports:
            - 8091
            - 11210

Then you have to configure the component:

return  [
    ...
    'components' => [
        ...
        'couchbase' => [
            'class' => \albertborsos\couchbase\Connection::class,
            'dsn' => 'cb',
            'username' => 'frontend',
            'password' => 'frontend',
            'defaultBucketName' => 'frontend',
            'defaultBucketPassword' => 'frontend',
        ],
        ...
    ],
    ...
];