HTMX utils to streamline your Laravel+HTMX powered site.
danherbert-io/elide-for-laravel is a Laravel package for htmx utils to streamline your laravel+htmx powered site..
It currently has 3 GitHub stars and 167 downloads on Packagist (latest version v1.1.2).
Install it with composer require danherbert-io/elide-for-laravel.
Discover more Laravel packages by danherbert-io
or browse all Laravel packages to compare alternatives.
Last updated
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.
[!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.
Elide has a simple starter kit to help you get going quickly.
laravel new --using=danherbert-io/elide-simple-starter-kit