matfire/laravel-electricsql

Utilities for ElectricSQL in Laravel

Maintainers

Package info

github.com/matfire/laravel-electricsql

pkg:composer/matfire/laravel-electricsql

Transparency log

Fund package maintenance!

matfire

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.0.1 2026-08-09 10:16 UTC

This package is auto-updated.

Last update: 2026-08-09 10:20:28 UTC


README

Laravel Electricsql

Packagist PHP from Packagist Laravel versions GitHub Workflow Status (main) Total Downloads

Utilities for ElectricSQL in Laravel

Installation

You can install the package via Composer:

composer require matfire/laravel-electricsql

You may publish all of the package's resources at once:

php artisan vendor:publish --tag="laravel-electricsql"

Or, you may publish each resource individually:

Publishing the Configuration File

php artisan vendor:publish --tag="laravel-electricsql-config"

Usage

You can use laravel-electricsql in two ways:

Route Macro

laravel-electricsql exposes a Route macro Route::electric that handles all the logic for you (sending the request, getting the response, stripping the headers) in a single line.

You can use it like so:

Route::electric('/electric/todo', ['table' => 'todos']);

This will register a GET route to the specified url and pass the keyed array as extra parameters to the request.

toResponse

If you want more control and handle some extra logic or effects in your own controller, laravel-electricsql also exposes the toResponse method. Since it's available as a singleton, you can get it in your Controller parameters and use it like so:

use Matfire\LaravelElectricsql\LaravelElectricsql;

class TodoElectricController extends Controller
{
    /**
     * Handle the incoming request.
     */
    public function __invoke(Request $request, LaravelElectricsql $electric)
    {
        return $electric->toResponse($request, ["table" => "todos"]);
    }
}

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Thank you for considering contributing to Laravel Electricsql! Please review our contributing guide to get started.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

Laravel Electricsql is open-sourced software licensed under the MIT license.