byjg / anydataset-nosql
A NoSql abstraction dataset. Anydataset is an agnostic data source abstraction layer in PHP.
Fund package maintenance!
byjg
Installs: 3 396
Dependents: 0
Suggesters: 0
Security: 0
Stars: 7
Watchers: 3
Forks: 2
Open Issues: 1
Requires
- php: >=8.1 <8.4
- ext-curl: *
- ext-json: *
- aws/aws-sdk-php: 3.*
- byjg/anydataset: ^5.0
- byjg/anydataset-array: ^5.0
- byjg/serializer: ^5.0
- byjg/webrequest: ^5.0
Requires (Dev)
- phpunit/phpunit: ^9.6
- vimeo/psalm: ^5.9
Suggests
- ext-mongodb: *
- byjg/cache-engine: ^5.0
Provides
README
Anydataset NoSQL standardize the access to non-relational databases/repositories and treat them as Key/Value. The implementation can work with:
- MongoDB
- Cloudflare KV
- S3
- DynamoDB
Anydataset is an agnostic data source abstraction layer in PHP. See more about Anydataset here.
Features
- Access as Key/Value repositories different datasource
- Allow put and get data
- Simplified way to connect to the datasources
Connection Based on URI
The connection string for databases is based on URL.
See below the current implemented drivers:
Examples
Check implementation examples on https://opensource.byjg.com/php/anydataset-nosql
Install
Just type:
composer require "byjg/anydataset-nosql"
Running Unit tests
docker-compose up -d export MONGODB_CONNECTION="mongodb://127.0.0.1/test" export S3_CONNECTION="s3://aaa:12345678@us-east-1/mybucket?create=true&endpoint=http://127.0.0.1:4566" export DYNAMODB_CONNECTION="dynamodb://accesskey:secretkey@us-east-1/tablename?endpoint=http://127.0.0.1:8000" vendor/bin/phpunit
Setup MongoDB for the unit test
Set the environment variable:
- MONGODB_CONNECTION = "mongodb://127.0.0.1/test"
Setup AWS DynamoDb for the unit test
Set the environment variable:
- DYNAMODB_CONNECTION = "dynamodb://accesskey:secretkey@region/tablename"
Setup AWS S3 for the unit test
Set the environment variable:
- S3_CONNECTION = "s3://accesskey:secretkey@region/bucketname"
Cloudflare KV
Set the environment variable:
- CLOUDFLAREKV_CONNECTION = "kv://email:authkey@accountid/namespaceid"