PHPackages                             jenryollivierre/laranonce - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. jenryollivierre/laranonce

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jenryollivierre/laranonce
=========================

A nonce generator for your laravel application.

v1.0(6y ago)1773[1 issues](https://github.com/JenryOllivierre/laranonce/issues)MITPHP

Since Mar 17Pushed 6y ago1 watchersCompare

[ Source](https://github.com/JenryOllivierre/laranonce)[ Packagist](https://packagist.org/packages/jenryollivierre/laranonce)[ RSS](/packages/jenryollivierre-laranonce/feed)WikiDiscussions master Synced yesterday

READMEChangelog (1)DependenciesVersions (2)Used By (0)

Laranonce
=========

[](#laranonce)

About
-----

[](#about)

Laranonce is a nonce generator for your laravel application.

Installation
------------

[](#installation)

Install via composer command `composer require jenryollivierre/laranonce`

Configuration
-------------

[](#configuration)

Publish the package's configuration file to configure options before starting to use the package. Use artisan command `php artisan vendor:publish --tag=laranonce-config`.

Configuration Options
---------------------

[](#configuration-options)

- **enabled**: Whether to enable the nonce functionality. If this is set to false, all nonce checks will pass as true wherever the check is done. This is particularly useful when testing your application to disable nonce checks. Defaults to true.
- **algorithm**: The hashing algorithm to use while generating the nonce. Defaults to 'sha256'. See
- **lifetime**: The time in seconds that the nonce will be valid for. Defaults to 900 seconds (15 minutes).
- **secret**: The secret key to use in the nonce generation process. This should not be a public key. Ideally, you should reference this value from your .env file. Defaults to App\_Key .env value.
- **driver**: The driver to use for the nonce process. Available drivers are database and file. File driver is recommended as it's twice as fast as the database driver. Defaults to file.
- **table\_name**: The name of the table to create if the database driver is being used.
- **storage\_disk**: The storage disk to store the nonces on when using the file driver. The public disk should never be used! Defaults to local.
- **storage\_directory**: A directory within the storage disk to store the nonces when using the file driver. Defaults to nonces.

How To Use
----------

[](#how-to-use)

On your form input field, call the `Laranonce\Facades\Nonce::generate()` method, which accepts one parameter, which is an identifier for the nonce. Try to make the name as unique as possible i.e `Laranonce\Facades\Nonce::generate('submit_cart_paypal_payment');`

```

```

Then on the backend, you check by using the Laranonce\\Facades\\Nonce::verify($name, $nonce) method, which accepts to parameters. The first parameter is the name of the nonce action, and the 2nd parameter is the nonce value that was submitted with the request:

```
