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
Requires
- php: ^8.2
- ext-json: *
- illuminate/support: ^11.0|^12.0
Requires (Dev)
- laravel/pint: ^1.23
- mockery/mockery: ^1.3.3
- orchestra/testbench: ^8.0|^9.2|^10.0
- phpunit/phpunit: ^10.4|^11.5
This package is auto-updated.
Last update: 2025-11-17 23:31:35 UTC
README
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
- Maurizio's Laravel HTMX package
- HTMX
- ThePrimeagen's intro to HTMX (it's for Golang, but still a great introduction to HTMX)