danherbert-io/elide-for-laravel

HTMX utils to streamline your Laravel+HTMX powered site.

Installs: 127

Dependents: 1

Suggesters: 0

Security: 0

Stars: 2

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/danherbert-io/elide-for-laravel

v1.0.10 2025-11-17 23:30 UTC

README

Elide package logo

Introduction

Elide (verb)

  • to join different things together as if they are the same; to become joined in this way

Elide is a small package for use with Laravel and HTMX. It aims to streamline the gap between backend and frontend by making it easy to return full page responses, or just partials (i.e., components). It also provides handy methods of checking HTMX properties of requests and responses.

Strongly inspired by Inertia.

use Elide\Htmx;
use App\Models\Product;
use App\View\Components\Content\ProductDetails;
use App\View\Components\Ui\ToastNotification;

class ViewProductController {
    public function __invoke(Product $product) {
        if (wasAddedToCart($product)) {
            Htmx::sendWithResponse(new ToastNotification('Added to cart!'));
        }
        
        return Htmx::render(new ProductDetails($product));
    }
}

Important

We're still writing Elide's documentation. For a practical example/reference you can check out the demonstration site: https://github.com/danherbert-io/elide-demo-site

Elide is open-source software licensed under the MIT licence.

Documentation

Important

Elide leverages HTMX's swap attributes - you should have an understanding of how HTMX works before using Elide. HTMX's documentation covers pretty much everything, and the HTMX examples provide a lot of practical examples of how to use HTMX in the frontend to talk to the backend.

Other resources