Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/affordablemobiles/eloquent-datastore
Google Datastore with Laravel's Eloquent ORM
https://github.com/affordablemobiles/eloquent-datastore
datastore eloquent google-datastore laravel php
Last synced: 2 months ago
JSON representation
Google Datastore with Laravel's Eloquent ORM
- Host: GitHub
- URL: https://github.com/affordablemobiles/eloquent-datastore
- Owner: affordablemobiles
- License: other
- Created: 2022-03-03T15:07:07.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2024-11-08T14:04:22.000Z (2 months ago)
- Last Synced: 2024-11-08T15:19:09.797Z (2 months ago)
- Topics: datastore, eloquent, google-datastore, laravel, php
- Language: PHP
- Homepage: https://packagist.org/packages/affordablemobiles/eloquent-datastore
- Size: 114 KB
- Stars: 4
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Laravel Eloquent for Google Datastore
![Latest Stable Version](https://poser.pugx.org/affordablemobiles/eloquent-datastore/v)
![License](https://poser.pugx.org/affordablemobiles/eloquent-datastore/license)A package for using Google Datastore as a database driver.
---
By using this package, you can use `query builder` and `eloquent` to access data from datastore.## Installation
**This package requires Laravel 9.x & PHP 8.1 as a minimum.**
You can install the package via composer:
```bash
composer require affordablemobiles/eloquent-datastore
```If you are using Laravel Package Auto-Discovery, you don't need you to manually add the ServiceProvider.
#### Without auto-discovery:
If you don't use auto-discovery, add the below ServiceProvider to the `$providers` array in `config/app.php` file.
```php
AffordableMobiles\EloquentDatastore\DatastoreServiceProvider::class,
```## Roadmap
- [x] Read data using query builder.
- [x] Read data using Eloquent model.
- [x] Insert data using Eloquent model.
- [x] Update data using Eloquent model.
- [x] Delete data.
- [x] Keys only queries.
- [x] Auto-generated primary key.
- [x] Read multiple pages of data with Datastore cursors.
- [x] Batch update from Eloquent collection.
- [ ] Cursor Paginate.
- [x] Ancestor key relations.
- [x] Datastore Namespaces (Multi-Tenancy).## Usage
You need to add `datastore` connection in `config/database.php` file.
```php
'connections' => [
...
'datastore' => [
'driver' => 'datastore',
'transport' => env('DATASTORE_TRANSPORT', 'grpc'),
],
...
],
```### Access using Eloquent Model
You need to extend `AffordableMobiles\EloquentDatastore\Eloquent\Model` class instead of Laravel's default Eloquent model class.
**Example-**
```php
table('projects')
->where('project_id', '>', 5)
->skip(3)
->take(5)
->get();
```
It will return a collection.## Tested Builder Functions
- [x] `connection`
- [x] `table`
- [x] `from`
- [x] `namespace` (Datastore Namespace: Multi Tenancy)
- [x] `select` (for projection query)
- [x] `kind` (same as table)
- [x] `where` (Available: = , > , < , >= , <= )
- [x] `limit` / `take`
- [x] `skip`
- [x] `orderBy`
- [x] `distinct`
- [x] `get`
- [x] `pluck`
- [x] `exists`
- [x] `count`
- [ ] `simplePaginate`
- [ ] `paginate` (works same as simplePaginate)
- [x] `first`
- [x] `delete`
- [x] `insert`
- [x] `_upsert` (different and incompatible with default `upsert`)
- [x] `find` / `lookup`
- [x] `chunk` / `chunkMap` / `each`
- [x] `lazy` / `cursor`## Contribution Guide
You can contribute by reporting bugs, fixing bugs, submitting and reviewing pull requests.
Go to **issues** section, and you can start working on an issue immediately.
## License
The MIT License (MIT). Please see [License File](LICENSE) for more information.