Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
albertborsos committed Oct 3, 2019
0 parents commit f0531f6
Show file tree
Hide file tree
Showing 31 changed files with 5,455 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .coveralls.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
service_name: travis-ci

coverage_clover: tests/_output/coverage.xml
json_path: tests/_output/unit.json
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/vendor
/tests/config/*.local.php
/tests/runtime
!/tests/runtime/.gitkeep
3 changes: 3 additions & 0 deletions .travis-php.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
extension=couchbase.so
# some other mongo specific configuration directives
# or general custom PHP settings...
40 changes: 40 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
sudo: required
language: php
dist: trusty

services:
- docker

php:
- 7.1
- 7.2
- 7.3

# cache vendor dirs
cache:
directories:
- $HOME/.composer/cache

before_install:
- wget http://packages.couchbase.com/releases/couchbase-release/couchbase-release-1.0-6-amd64.deb
- sudo dpkg -i couchbase-release-1.0-6-amd64.deb
- sudo apt-get -qq update
- sudo apt-get install -y -y --no-install-recommends libssl1.0.0 libcouchbase-dev
- pecl install couchbase
- sudo wget http://packages.couchbase.com/releases/4.1.1/couchbase-server-community_4.1.1-ubuntu12.04_amd64.deb
- sudo dpkg -i couchbase-server-community_4.1.1-ubuntu12.04_amd64.deb
- sleep 10
- sudo /opt/couchbase/bin/couchbase-cli cluster-init -c localhost:8091 -u Administrator -p password --cluster-ramsize=256 --service=data,index,query
- sudo /opt/couchbase/bin/couchbase-cli bucket-create -c localhost:8091 -u Administrator -p password --bucket=default --bucket-ramsize=256 --bucket-replica=1

install:
- composer self-update && composer --version
- export PATH="$HOME/.composer/vendor/bin:$PATH"
- composer install --prefer-dist --no-interaction

script:
- sh ./phpcs.sh
- php ./vendor/bin/codecept run unit -d --coverage --coverage-xml

after_success:
- php ./vendor/bin/php-coveralls -v --exclude-no-stmt -c .coveralls.yml
82 changes: 82 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
[![Build Status](https://travis-ci.org/albertborsos/yii2-couchbase.svg?branch=master)](https://travis-ci.org/albertborsos/yii2-couchbase)
[![Coverage Status](https://coveralls.io/repos/github/albertborsos/yii2-couchbase/badge.svg)](https://coveralls.io/github/albertborsos/yii2-couchbase)

Yii 2.0 Couchbase Component
===========================
Couchbase component for Yii 2.0 Framework

Installation
------------

The preferred way to install this extension is through [composer](http://getcomposer.org/download/).

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`:
```ini
extension=couchbase.so
; priority=30
```

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

```dockerfile
#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

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

Then you have to configure the component:

```php
return [
...
'components' => [
...
'couchbase' => [
'class' => \albertborsos\couchbase\Connection::class,
'dsn' => 'cb',
'username' => 'frontend',
'password' => 'frontend',
'defaultBucketName' => 'frontend',
'defaultBucketPassword' => 'frontend',
],
...
],
...
];
```
16 changes: 16 additions & 0 deletions codeception.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
paths:
tests: tests
output: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
actor_suffix: Tester
settings:
bootstrap: _bootstrap.php
extensions:
enabled:
- Codeception\Extension\RunFailed
coverage:
enabled: true
include:
- src/*
39 changes: 39 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"name": "albertborsos/yii2-couchbase",
"description": "Couchbase component for Yii 2.0 Framework",
"type": "yii2-extension",
"keywords": ["yii2","extension"],
"license": "MIT",
"authors": [
{
"name": "Albert Borsos",
"email": "hello@borsosalbert.hu"
}
],
"require": {
"php": ">=7.1.0",
"yiisoft/yii2": "~2.0.0"
},
"require-dev": {
"phpunit/phpunit": "~7.5",
"codeception/base": "~3.0",
"codeception/verify": "~1.0",
"codeception/specify": "~1.0",
"codeception/mockery-module": "^0.3.0",
"php-coveralls/php-coveralls": "^2.1",
"mito/yii2-coding-standards": "~2.0.0@beta"
},
"autoload": {
"psr-4": {
"albertborsos\\couchbase\\": "src",
"albertborsos\\couchbase\\tests\\": "tests",
"albertborsos\\couchbase\\tests\\support\\base\\": "tests/_support/base"
}
},
"repositories": [
{
"type": "composer",
"url": "https://asset-packagist.org"
}
]
}
Loading

0 comments on commit f0531f6

Please sign in to comment.