Download the PHP package mauricius/laravel-htmx without Composer

On this page you can find all versions of the php package mauricius/laravel-htmx. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-htmx

laravel-htmx

Laravel integration for htmx.

Latest Version on Packagist GitHub Tests Action Status Total Downloads

Supported Laravel Versions >= v8.80.0.

Installation

You can install the package via composer:

You can publish the config file with:

This is the contents of the published config file:

To install htmx please browse their documentation

Usage

Request

You can resolve an instance of the HtmxRequest from the container which provides shortcuts for reading the htmx-specific request headers.

Response

htmx can trigger a client side redirect when it receives a response with the HX-Redirect header. The HtmxResponseClientRedirect makes it easy to trigger such redirects.

htmx will trigger a page reload when it receives a response with the HX-Refresh header. HtmxResponseClientRefresh is a custom response class that allows you to send such a response. It takes no arguments, since htmx ignores any content.

When using a polling trigger, htmx will stop polling when it encounters a response with the special HTTP status code 286. HtmxResponseStopPolling is a custom response class with that status code.

For all the remaining available headers you can use the HtmxResponse class.

Additionally, you can trigger client-side events using the addTrigger methods.

If you want to pass details along with the event you can use the second argument to send a body. It supports strings or arrays.

You can call those methods multiple times if you want to trigger multiple events.

Render Blade Fragments

This library also provides a basic Blade extension to render template fragments.

The library provides two new Blade directives: @fragment and @endfragment. You can use these directives to specify a block of content within a template and render just that bit of content. For instance:

With this fragment defined in our template, we can now render either the entire template:

Or we can render only the archive-ui fragment of the template by using the renderFragment macro defined in the \Illuminate\View\View class:

OOB Swap support

htmx supports updating multiple targets by returning multiple partial responses with hx-swap-oop. With this library you can return multiple fragments by using the HtmxResponse as a return type.

For instance, let's say that we want to mark a todo as completed using a PATCH request to /todos/{id}. With the same request, we also want to update in the footer how many todos are left:

We can use the HtmxResponse to return multiple fragments:

Testing

Changelog

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

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

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

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-htmx with dependencies

PHP Build Version
Package Version
Requires ext-mbstring Version *
php Version ^8.1
illuminate/contracts Version ^9.0|^10.0|^11.0|^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package mauricius/laravel-htmx contains the following files

Loading the files please wait ....