PHPackages                             eznix86/laravel-litestream - 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. eznix86/laravel-litestream

ActiveLibrary[Database &amp; ORM](/categories/database)

eznix86/laravel-litestream
==========================

Litestream integration for Laravel

v2.0.0(2mo ago)417[1 PRs](https://github.com/eznix86/laravel-litestream/pulls)MITPHPPHP ^8.4CI passing

Since Feb 18Pushed 2mo agoCompare

[ Source](https://github.com/eznix86/laravel-litestream)[ Packagist](https://packagist.org/packages/eznix86/laravel-litestream)[ RSS](/packages/eznix86-laravel-litestream/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (30)Versions (12)Used By (0)

Litestream for Laravel
======================

[](#litestream-for-laravel)

[![Litestream for Laravel](./art/litestream-for-laravel.png)](./art/litestream-for-laravel.png)

[Litestream](https://litestream.io/) is a streaming replication tool for SQLite.

Introduction
------------

[](#introduction)

This package is built for SQLite-first Laravel apps and will continuously stream SQLite changes to your preferred cloud storage or local files.

This will help you to quickly recover to the point of failure if your server goes down.

Litestream itself runs as a separate process and does not require application-level replication code changes. If you are new to Litestream, start with the official [Litestream Getting Started guide](https://litestream.io/getting-started/) and [How it works](https://litestream.io/how-it-works/).

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

[](#requirements)

- PHP `^8.4`
- Litestream binary support on macOS or Linux
- SQLite should be configured correctly. (See Get Started)

Windows is not supported.

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

[](#installation)

Install the package with Composer:

```
composer require eznix86/laravel-litestream
```

Publish the configuration file:

```
php artisan vendor:publish --tag=litestream-config
```

Get Started
-----------

[](#get-started)

Use this quick sequence to get replication running in a Laravel app.

### 1) Configure SQLite for Litestream safety

[](#1-configure-sqlite-for-litestream-safety)

In `config/database.php`, make sure the target SQLite connection uses:

- `driver` =&gt; `sqlite`
- `busy_timeout` =&gt; `5000` (can be more but not less)
- `journal_mode` =&gt; `WAL`
- `synchronous` =&gt; `NORMAL`
- `foreign_key_constraints` =&gt; `true`

### 2) Configure your Litestream replica

[](#2-configure-your-litestream-replica)

Update `config/litestream.php`:

- set one or more `connections`
- point each connection to one or more replica
- configure the replica details under `replicas` (for example `s3`)

If you are using S3-compatible storage, review Litestream's official docs for provider-specific endpoint and credential requirements:

- [Replicating to Amazon S3](https://litestream.io/guides/s3/)
- [Configuration file reference](https://litestream.io/reference/config/)

### IPC Socket

[](#ipc-socket)

The package can write Litestream's control socket settings into generated YAML:

```
'socket' => [
    'enabled' => true,
    'path' => env('LITESTREAM_SOCKET_PATH'),
    'permissions' => env('LITESTREAM_SOCKET_PERMISSIONS', 0o600),
],
```

Defaults:

- `socket.enabled`: `true`
- `socket.path`: `/litestream.sock` when `LITESTREAM_SOCKET_PATH` is not set
- `socket.permissions`: `0600` (stored as numeric permissions in generated YAML)

### 3) Install Litestream binary

[](#3-install-litestream-binary)

```
php artisan litestream:install
```

This downloads the latest compatible Litestream binary to `litestream.binary_path` and marks it executable.

If Litestream is already installed on your server, point to it instead of downloading:

```
LITESTREAM_BINARY_PATH=/usr/local/bin/litestream
```

### 4) Start replication

[](#4-start-replication)

```
php artisan litestream:replicate
```

The command validates configuration, regenerates YAML at `litestream.config_path`, and starts `litestream replicate`.

### 5) Verify status and test restore

[](#5-verify-status-and-test-restore)

```
php artisan litestream:status
php artisan litestream:reset
php artisan litestream:restore
php artisan litestream:sync
```

For deeper operational guidance, see:

- [Litestream tips and caveats](https://litestream.io/tips/)
- [Litestream restore command reference](https://litestream.io/reference/restore/)
- [Litestream troubleshooting](https://litestream.io/docs/troubleshooting/)

### Replicas

[](#replicas)

Each `replicas.` entry is passed through to Litestream YAML.

- Keys are normalized recursively from `snake_case` to `kebab-case` when YAML is generated.
- You can use `['env' => 'VAR_NAME']` for any replica value to emit `${VAR_NAME}` in YAML and inject the real value at runtime via process environment.

For the complete list of replica options per backend, refer to the official Litestream configuration reference:

- [Replica settings reference](https://litestream.io/reference/config/#replica-settings)

Example:

```
'replicas' => [
    's3' => [
        'type' => 's3',
        'bucket' => env('LITESTREAM_S3_BUCKET'),
        'path' => env('LITESTREAM_S3_PATH'),
        'access_key_id' => env('LITESTREAM_ACCESS_KEY_ID'),
        'secret_access_key' => env('LITESTREAM_SECRET_ACCESS_KEY'),
        'custom_options' => [
            'force_path_style' => true,
        ],
    ],
],
```

Generated YAML keys become:

- `access-key-id`
- `secret-access-key`
- `custom-options.force-path-style`

Path Modes
----------

[](#path-modes)

`path_mode` controls how the replica `path` value is transformed per connection:

- `append`: `/`
- `replace`: ``
- `preserve`: keep replica `path` unchanged

V1 behavior applies this only to the flat `path` field in each replica definition.

Runtime Connection Resolver
---------------------------

[](#runtime-connection-resolver)

By default, commands use `config('litestream.connections')`.

If you need resolve the connections at run time, use `resolveConnectionsUsing`:

```
use Eznix86\Litestream\Facades\Litestream;

Litestream::resolveConnectionsUsing(function (array $connections): array {
    return array_merge($connections, [
        'analytics' => [
            'name' => 'analytics',
            'replicas' => ['s3'],
            'path_mode' => 'append',
        ],
    ]);
});
```

This is useful when you want to:

- add runtime-specific connections on top of static config ex. Multi-tenants
- filter which configured connections run in a given context
- fully replace config connections from another source at runtime.

To return to config-only behavior:

```
Litestream::forgetConnectionResolver();
```

Commands
--------

[](#commands)

For native command behavior and all flags, refer to Litestream's upstream command docs:

- [Command: replicate](https://litestream.io/reference/replicate/)
- [Command: databases](https://litestream.io/reference/databases/)
- [Command: restore](https://litestream.io/reference/restore/)
- [Command: sync](https://litestream.io/reference/sync/)

Testing and Quality
-------------------

[](#testing-and-quality)

Run tests:

```
vendor/bin/pest
```

Run static analysis:

```
vendor/bin/phpstan analyse --memory-limit=1G
```

Run formatting checks:

```
vendor/bin/pint --test
```

Run refactoring checks:

```
vendor/bin/rector process --dry-run
```

Further Reading
---------------

[](#further-reading)

For anything not covered by this package README, use the official Litestream documentation:

- [Litestream docs index](https://litestream.io/docs/)
- [Litestream guides](https://litestream.io/guides/)
- [Litestream reference](https://litestream.io/reference/)

License
-------

[](#license)

This package is open-sourced software licensed under the MIT license.

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance86

Actively maintained with recent releases

Popularity11

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~3 days

Total

10

Last Release

62d ago

Major Versions

v1.4.2 → v2.0.02026-03-18

### Community

Maintainers

![](https://www.gravatar.com/avatar/f52290ecebdd960ddfacf23d664e78b03c13f81fba7fbba661161b050f6a4150?d=identicon)[eznix86](/maintainers/eznix86)

---

Top Contributors

[![eznix86](https://avatars.githubusercontent.com/u/26553194?v=4)](https://github.com/eznix86 "eznix86 (25 commits)")

---

Tags

laravellitestreamsqlite

###  Code Quality

TestsPest

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/eznix86-laravel-litestream/health.svg)

```
[![Health](https://phpackages.com/badges/eznix86-laravel-litestream/health.svg)](https://phpackages.com/packages/eznix86-laravel-litestream)
```

###  Alternatives

[ryangjchandler/orbit

A flat-file database driver for Eloquent.

922256.2k5](/packages/ryangjchandler-orbit)[kimai/kimai

Kimai - Time Tracking

4.6k7.4k1](/packages/kimai-kimai)[pixelfederation/doctrine-resettable-em-bundle

Symfony bundle for decorating default entity managers using a resettable decorator.

20113.5k](/packages/pixelfederation-doctrine-resettable-em-bundle)[rcsofttech/audit-trail-bundle

Enterprise-grade, high-performance Symfony audit trail bundle. Automatically track Doctrine entity changes with split-phase architecture, multiple transports (HTTP, Queue, Doctrine), and sensitive data masking.

1022.4k](/packages/rcsofttech-audit-trail-bundle)[perplorm/perpl

Perpl is an improved and still maintained fork of Propel2, an open-source Object-Relational Mapping (ORM) for PHP.

203.7k](/packages/perplorm-perpl)

PHPackages © 2026

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