Download the PHP package devmatic/laravel-instantclick without Composer
On this page you can find all versions of the php package devmatic/laravel-instantclick. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download devmatic/laravel-instantclick
More information about devmatic/laravel-instantclick
Files in devmatic/laravel-instantclick
Package laravel-instantclick
Short Description An InstantClick middleware for Laravel 5
License MIT
Homepage https://github.com/devmatic/laravel-instantclick
Informations about the package laravel-instantclick
An InstantClick middleware for Laravel 5
InstantClick is a plugin that makes following links in your website instant by leverages ajax to speed up the loading time of your pages.
InstantClick uses pushState and Ajax (a combo known as pjax), replacing only the body and the title in the head.
Devmatic is a web development company aims to make developers life easier. You’ll find an overview of all our projects on our website.
Ajax brings two nice benefits in and of itself:
- Your browser doesn’t have to throw and recompile scripts and styles on each page change anymore.
- You don’t get a white flash while your browser is waiting for a page to display, making your website feel faster.
This package provides a middleware that can return the response that this plugin expects.
Video Tutorial & Overview
Installation & Usage
-
You can install the package via composer:
-
Next you must add the
\Devmatic\InstantClick\Middleware\FilterIfInstantClick
-middleware to the kernel. -
Copy the included instantclick.js to your proper public asset folder then include it at your layout file like this:
- Please refer to InstantClient documentation to know more about InstantClient options and how it works.
Important Note
please use the included instantclick.js file because I modify it by adding $xhr.setRequestHeader(‘X-INSTANTCLICK’, true) to give the middleware the ability to identify InstantClient requests and give the proper response to it.
How it Works
The provided middleware provides the behaviour that the Instant Click plugin expects of the server:
An X-INSTANTCLICK request header is set to differentiate a InstantClick request from normal XHR requests. In this case, if the request is InstantClick, we skip the layout html and just render the inner contents of the body.
Change log
Please see CHANGELOG for more information what has changed recently.
Testing
Contributing
Please see CONTRIBUTING for details.
Credits
- Diaa Fares
- All Contributors
The middleware in this package was originally written by Freek Van der Herten for return the response that Pjax jquery plugin expects, I edit his middleware and InstantClick plugin to make it work for Laravel. His original code can be found in this repo on GitHub.
License
The MIT License (MIT). Please see License File for more information.
All versions of laravel-instantclick with dependencies
illuminate/support Version ^5.1
illuminate/http Version ^5.1
symfony/dom-crawler Version ^2.7|^3.0
symfony/css-selector Version ^2.7|^3.0