This Symfony bundle is a wrapper around bowlofsoup/couchbase-access-layer. Checkout the README.md of that repository on how to use it.
Require the bundle via composer in your Symfony ^7.0 project.
composer require bowlofsoup/couchbase-access-layer-bundle
Add the bundle to your AppKernel.php
.
$bundles = [
...
new \BowlOfSoup\CouchbaseAccessLayerBundle\CouchbaseAccessLayerBundle()
...
];
Add the correct parameters in a new file: config/packages/couchbase_access_layer.yml
.
couchbase_access_layer:
host: '%env(COUCHBASE_HOST)%'
user: '%env(COUCHBASE_USER)%'
password: '%env(COUCHBASE_PASSWORD)%'
bucket_default: '%env(COUCHBASE_DEFAULT_BUCKET)%'
Make sure to add the correct configuration values to your .env file:
COUCHBASE_HOST="127.0.0.1"
COUCHBASE_USER="couchbase_user"
COUCHBASE_PASSWORD="couchbase_password"
COUCHBASE_DEFAULT_BUCKET="default"
You can use BowlOfSoup\CouchbaseAccessLayer\Repository\BucketRepository
as dependency for your service.
It will take the 'default' bucket you configured for you to use the query builder on.
See the README.md of the bowlofsoup/couchbase-access-layer repository on how to use this 'query builder'.
You can also make your own definition of a BucketRepository to use a different bucket than the default you configured.
my_own_bucket_repository:
class: BowlOfSoup\CouchbaseAccessLayer\Repository\BucketRepository
arguments:
- 'your bucket'
- '@BowlOfSoup\CouchbaseAccessLayer\Factory\ClusterFactory'
This goes in your own services.yml
definition.