Download the PHP package darkghosthunter/larapoke without Composer

On this page you can find all versions of the php package darkghosthunter/larapoke. 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 larapoke

Package superseeded by Laragear/Poke


Larapoke

Keep your forms alive, avoid TokenMismatchException by gently poking your Laravel app.

Requirements

For older versions support, consider helping by sponsoring or donating.

Installation

Require this package into your project using Composer:

How does it work?

Larapoke pokes your App with an HTTP HEAD request to the /poke route at given intervals. In return, while your application renews the session lifetime, it sends an HTTP 204 status code, which is an OK Response without body.

This amounts to barely 800 bytes sent!

Automatic Reloading on CSRF token expiration

Larapoke script will detect if the CSRF session token is expired based on the last successful poke, and forcefully reload the page if there is Internet connection.

This is done by detecting when the browser or tab becomes active, or when the device user becomes online again.

This is handy in situations when the user laptop is put to sleep, or the phone loses signal. Because the session may expire during these moments, when the browser wakes up or the phone becomes online, the page is reloaded to get the new CSRF token.

Usage

There are three ways to turn on Larapoke in your app.

You can change the default mode using your environment file:

auto

Just install this package and look at it go. This will push a global middleware that will look into all your Responses content where:

If there is any case-insensitive match, this will inject the Larapoke script in charge to keep the forms alive just before the </body> tag.

This mode won't inject the script on no-successful responses (anything not HTTP 2xx), like on errors or redirection.

It's recommended to use the other modes if your application has many routes or Responses with a lot of text.

middleware

This will disable the global middleware, allowing you to use the larapoke middleware only in the routes you explicitly decide.

This will forcefully inject the script, even if there is no form, into the route. You can also apply this to a route group.

Since a route group may contain routes without any form, you can add the detect option to the middleware which will scan the Response for a CSRF token and inject the script only if it finds one.

This mode won't inject the script on no-successful responses (anything not HTTP 2xx), like on errors or redirection.

blade

The blade method allows you to use the @larapoke directive to inject the script anywhere in your view, keeping the forms of that Response alive.

Don't worry if you use many @larapoke directives in your view, like in this example. The script can be injected multiple times, but only the first script will run and poke the site.

Configuration

For fine-tuning, you can publish the larapoke.php config file.

Let's examine the configuration array for Larapoke:

Times (Interval)

How many times the poking will be done relative to the global session lifetime. The more times, the shorter the poking interval. The default 4 should be fine for any normal application.

For example, if our session lifetime is the default of 120 minutes:

So, basically, session lifetime / times = poking interval.

You should raise it if you expect your users to have a lot of doing nothing and may quit at any given time.

Script View

Larapoke uses its own Blade template to inject the script.

You can use other view with the script or overriding the default by creating a views/vendor/larapoke/script.blade.php file. The latter option doesn't need to publish the config file.

Why would you? Some people may want to change this because they want to use a Javascript HTTP library, minify the response, make it compatible for older browsers, or even create a custom Event when CSRF token expires.

The view receives three variables:

Poking

This is the array of settings for the poking route which receives the script HTTP HEAD Request.

Route

The route (relative to the root URL of your application) that will be using to receive the pokes.

The poke routes are registered before any set in your application. You could override the poke route with your own logic before responding with HTTP 204.

Name

Name of the route, to find the poke route in your app for whatever reason.

If you're using an array of domains or subdomains, this string will be appended to the route name.

Domains

In case you are using different domains of subdomains, it may be convenient to allow this route only under a certain one instead of all domains. A classic example is to make the poking available at http://user.myapp.com/poke but no http://myapp.com/poke.

If you use an array, the route names will be conveniently names using the domain name as a prefix, like myotherdomain.com-larapoke.

Middleware

The default Larapoke route uses the "web" middleware group, which is the default for handling web requests in a fresh installation. If you are using another group, or want to use a particular middleware, you can modify where here.

License

This package is licenced by the MIT License.


All versions of larapoke with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
illuminate/http Version ^7.0||^8.0
illuminate/routing Version ^7.0||^8.0
illuminate/support Version ^7.0||^8.0
illuminate/view Version ^7.0||^8.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 darkghosthunter/larapoke contains the following files

Loading the files please wait ....