PHPackages                             a1comms/eloquent-datastore - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. a1comms/eloquent-datastore

Abandoned → [affordablemobiles/eloquent-datastore](/?search=affordablemobiles%2Feloquent-datastore)Package[Database &amp; ORM](/categories/database)

a1comms/eloquent-datastore
==========================

A package for using Google Datastore as a database driver.

v12.0.4(2mo ago)48.1k32MITPHPPHP ^8.3CI passing

Since Nov 26Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/affordablemobiles/eloquent-datastore)[ Packagist](https://packagist.org/packages/a1comms/eloquent-datastore)[ RSS](/packages/a1comms-eloquent-datastore/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (18)Versions (34)Used By (2)

Laravel Eloquent for Google Datastore
=====================================

[](#laravel-eloquent-for-google-datastore)

[![Latest Stable Version](https://camo.githubusercontent.com/671b0fce7154004f194ff16634b37698bb3ad54769bc50b65b1b857152c760bc/68747470733a2f2f706f7365722e707567782e6f72672f6166666f726461626c656d6f62696c65732f656c6f7175656e742d6461746173746f72652f76)](https://camo.githubusercontent.com/671b0fce7154004f194ff16634b37698bb3ad54769bc50b65b1b857152c760bc/68747470733a2f2f706f7365722e707567782e6f72672f6166666f726461626c656d6f62696c65732f656c6f7175656e742d6461746173746f72652f76)[![License](https://camo.githubusercontent.com/62a8a2aff84da528262bc168db2e53344c299db82db99aab67091d99777bbe34/68747470733a2f2f706f7365722e707567782e6f72672f6166666f726461626c656d6f62696c65732f656c6f7175656e742d6461746173746f72652f6c6963656e7365)](https://camo.githubusercontent.com/62a8a2aff84da528262bc168db2e53344c299db82db99aab67091d99777bbe34/68747470733a2f2f706f7365722e707567782e6f72672f6166666f726461626c656d6f62696c65732f656c6f7175656e742d6461746173746f72652f6c6963656e7365)

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
------------

[](#installation)

**This package requires PHP 8.3 as a minimum.**

This branch targets Laravel 12.x. For compatibility with other Laravel versions, please see the appropriate branch.

You can install the package via composer:

```
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:

[](#without-auto-discovery)

If you don't use auto-discovery, add the below ServiceProvider to the `$providers` array in `config/app.php` file.

```
AffordableMobiles\EloquentDatastore\DatastoreServiceProvider::class,
```

Roadmap
-------

[](#roadmap)

- Read data using query builder.
- Read data using Eloquent model.
- Insert data using Eloquent model.
- Update data using Eloquent model.
- Delete data.
- Keys only queries.
- Auto-generated primary key.
- Read multiple pages of data with Datastore cursors.
- Batch update from Eloquent collection.
- `cursorPaginate` (Datastore cursors are used for `chunk` and `lazy`, but full pagination is not yet implemented)
- Ancestor key relations.
- Datastore Namespaces (Multi-Tenancy).

Usage
-----

[](#usage)

You need to add `datastore` connection in `config/database.php` file.

```
'connections' => [
    ...
    'datastore' => [
        'driver' => 'datastore',
        'transport' => env('DATASTORE_TRANSPORT', 'grpc'),
    ],
    ...
],
```

### Access using Eloquent Model

[](#access-using-eloquent-model)

You need to extend `AffordableMobiles\EloquentDatastore\Eloquent\Model` class instead of Laravel's default Eloquent model class.

**Example-**

```
