PHPackages                             richan-fongdasen/firestore-laravel - 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. [Caching](/categories/caching)
4. /
5. richan-fongdasen/firestore-laravel

ActiveLibrary[Caching](/categories/caching)

richan-fongdasen/firestore-laravel
==================================

A Google Cloud Firestore driver for Laravel Cache and Session.

1.1.0(1y ago)0300[4 PRs](https://github.com/richan-fongdasen/firestore-laravel/pulls)MITPHPPHP ^8.2CI passing

Since May 26Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/richan-fongdasen/firestore-laravel)[ Packagist](https://packagist.org/packages/richan-fongdasen/firestore-laravel)[ Docs](https://github.com/richan-fongdasen/firestore-laravel)[ GitHub Sponsors](https://github.com/richan-fongdasen)[ RSS](/packages/richan-fongdasen-firestore-laravel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (17)Versions (6)Used By (0)

A Google Cloud Firestore driver for Laravel Cache and Session
=============================================================

[](#a-google-cloud-firestore-driver-for-laravel-cache-and-session)

[![Latest Version on Packagist](https://camo.githubusercontent.com/a2cacbeca5d9aa38b037bbe91388645aa04559ffa1ab455edf2df3cf2699a406/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72696368616e2d666f6e67646173656e2f6669726573746f72652d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/richan-fongdasen/firestore-laravel)[![License: MIT](https://camo.githubusercontent.com/8c1e27f78909ba5be612de7397f25ee00c0eb4a09ca8a51a6166587ee5dbf202/68747470733a2f2f706f7365722e707567782e6f72672f72696368616e2d666f6e67646173656e2f6669726573746f72652d6c61726176656c2f6c6963656e73652e737667)](https://opensource.org/licenses/MIT)[![PHPStan](https://github.com/richan-fongdasen/firestore-laravel/actions/workflows/phpstan.yml/badge.svg?branch=main)](https://github.com/richan-fongdasen/firestore-laravel/actions/workflows/phpstan.yml)[![Test](https://github.com/richan-fongdasen/firestore-laravel/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/richan-fongdasen/firestore-laravel/actions/workflows/test.yml)[![Coding Style](https://github.com/richan-fongdasen/firestore-laravel/actions/workflows/coding-style.yml/badge.svg?branch=main)](https://github.com/richan-fongdasen/firestore-laravel/actions/workflows/coding-style.yml)[![codecov](https://camo.githubusercontent.com/0652b06548360d3378981eb4655e339fcf9778df23f42e7fa68e4b1ceb9f7826/68747470733a2f2f636f6465636f762e696f2f67682f72696368616e2d666f6e67646173656e2f6669726573746f72652d6c61726176656c2f67726170682f62616467652e7376673f746f6b656e3d526a5736657777655279)](https://codecov.io/gh/richan-fongdasen/firestore-laravel)[![Total Downloads](https://camo.githubusercontent.com/5b37874818de9d41986434b0e4e632bafd42040ce17a5d9d544ee6e498dd0b5b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72696368616e2d666f6e67646173656e2f6669726573746f72652d6c61726176656c2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/richan-fongdasen/firestore-laravel)

This package allows you to use Google Cloud Firestore as a driver for Cache and Session store in Laravel application. This package is built on top of the official [Google Cloud Firestore PHP client library](https://github.com/googleapis/google-cloud-php-firestore).

Warning

This package is not yet compatible with [Laravel Octane](https://github.com/laravel/octane).

Requirements
------------

[](#requirements)

- PHP 8.2 or higher
- Laravel 10.0 or higher
- PHP Extension: `grpc`
- PHP Extension: `protobuf`
- Google Cloud Firestore Credentials

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

[](#installation)

You can install the package via composer:

```
composer require richan-fongdasen/firestore-laravel
```

You can publish the config file with:

```
php artisan vendor:publish --tag="firestore-laravel-config"
```

This is the contents of the published config file:

```
return [
    'project_id'  => env('GOOGLE_CLOUD_PROJECT'),
    'credentials' => env('GOOGLE_APPLICATION_CREDENTIALS'),
    'database'    => env('FIRESTORE_DATABASE', '(default)'),

    'cache' => [
        'collection'           => env('FIRESTORE_CACHE_COLLECTION', 'cache'),
        'key_attribute'        => env('FIRESTORE_CACHE_KEY_ATTR', 'key'),
        'value_attribute'      => env('FIRESTORE_CACHE_VALUE_ATTR', 'value'),
        'expiration_attribute' => env('FIRESTORE_CACHE_EXPIRATION_ATTR', 'expired_at'),
    ],

    'session' => [
        'collection' => env('FIRESTORE_SESSION_COLLECTION', 'sessions'),
    ],
];
```

Configuration
-------------

[](#configuration)

### Setting Up Firestore Authentication

[](#setting-up-firestore-authentication)

Please see the [Authentication guide](https://github.com/googleapis/google-cloud-php/blob/main/AUTHENTICATION.md) for more information on authenticating your Google Cloud Firestore client.

### Package Configuration

[](#package-configuration)

You can configure the package by setting the following environment variables in your `.env` file.

```
GOOGLE_CLOUD_PROJECT=your-google-cloud-project-id
GOOGLE_APPLICATION_CREDENTIALS="/path-to/your-service-account.json"
FIRESTORE_DATABASE="(default)"
FIRESTORE_CACHE_COLLECTION=cache
FIRESTORE_CACHE_KEY_ATTR=key
FIRESTORE_CACHE_VALUE_ATTR=value
FIRESTORE_CACHE_EXPIRATION_ATTR=expired_at
FIRESTORE_SESSION_COLLECTION=sessions
```

### Cache Store Configuration

[](#cache-store-configuration)

In order to use Firestore as a cache store, you need to append the following configuration into the `config/cache.php` file.

```
'stores' => [
    'firestore' => [
        'driver' => 'firestore',
    ],
],
```

### Session Driver Configuration

[](#session-driver-configuration)

In order to use Firestore as a session store, you need to modify the `SESSION_DRIVER` environment variable in your `.env` file.

```
SESSION_DRIVER=firestore
```

Usage
-----

[](#usage)

There is no special usage for this package. You can use the Cache and Session store as you normally do in Laravel.

```
// Cache store
Cache::put('key', 'value', 60); // Store a value in the cache for 60 seconds

$value = Cache::get('key'); // Retrieve a value from the cache

// Session
session(['key' => 'value']); // Store a value in the session

$value = session('key'); // Retrieve a value from the session
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Richan Fongdasen](https://github.com/richan-fongdasen)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

41

—

FairBetter than 89% of packages

Maintenance71

Regular maintenance activity

Popularity14

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity57

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~278 days

Total

2

Last Release

438d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5222595?v=4)[Richan Fongdasen](/maintainers/richan-fongdasen)[@richan-fongdasen](https://github.com/richan-fongdasen)

---

Top Contributors

[![richan-fongdasen](https://avatars.githubusercontent.com/u/5222595?v=4)](https://github.com/richan-fongdasen "richan-fongdasen (14 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (6 commits)")

---

Tags

cachecloud-firestorefirestoregoogle-cloud-firestorelaravelsessionlaravelcachesessiongoogle cloudfirestorecloud firestoreRichan Fongdasen

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/richan-fongdasen-firestore-laravel/health.svg)

```
[![Health](https://phpackages.com/badges/richan-fongdasen-firestore-laravel/health.svg)](https://phpackages.com/packages/richan-fongdasen-firestore-laravel)
```

###  Alternatives

[spatie/laravel-responsecache

Speed up a Laravel application by caching the entire response

2.8k8.2M51](/packages/spatie-laravel-responsecache)[dragon-code/laravel-cache

An improved interface for working with cache

6844.8k10](/packages/dragon-code-laravel-cache)[anahkiasen/flatten

A package for the Illuminate framework that flattens pages to plain HTML

33313.0k](/packages/anahkiasen-flatten)[harris21/laravel-fuse

Circuit breaker for Laravel queue jobs. Protect your workers from cascading failures.

3786.5k](/packages/harris21-laravel-fuse)[ytake/laravel-couchbase

Couchbase providers for Laravel

3051.9k](/packages/ytake-laravel-couchbase)[karriere/state

Laravel package for storing current application state in cache/session

1718.5k](/packages/karriere-state)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
