PHPackages                             mxl/laravel-api-key - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. mxl/laravel-api-key

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

mxl/laravel-api-key
===================

API key authorization for Laravel with replay attack prevention

v1.0.1(5y ago)6641MITPHPPHP &gt;=7.1CI failing

Since Apr 13Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mxl/laravel-api-key)[ Packagist](https://packagist.org/packages/mxl/laravel-api-key)[ Docs](https://github.com/mxl/laravel-api-key)[ RSS](/packages/mxl-laravel-api-key/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (3)Used By (0)

laravel-api-key
===============

[](#laravel-api-key)

[![Current version](https://camo.githubusercontent.com/8093d44e2cc10c51c71d9aa480cba5e0032974bdefcdbacec8443e360adc3f44/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d786c2f6c61726176656c2d6170692d6b65792e7376673f6c6f676f3d636f6d706f736572)](https://packagist.org/packages/mxl/laravel-api-key)[![Monthly Downloads](https://camo.githubusercontent.com/f7e8cec9d9c07bf4ebfeb277268e97f2f2f660e0f8560785265920a51de38e16/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d786c2f6c61726176656c2d6170692d6b65792e737667)](https://packagist.org/packages/mxl/laravel-api-key/stats)[![Total Downloads](https://camo.githubusercontent.com/66b6bfb93628833460ac552f2f357d44c5ee913c4a2b5c0407592ee2c1a97e4a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d786c2f6c61726176656c2d6170692d6b65792e737667)](https://packagist.org/packages/mxl/laravel-api-key/stats)[![Build Status](https://camo.githubusercontent.com/b32c9ce0f7ffa8eb57739239fda61ee5dd4575667a4b80e6c986761064dd3826/68747470733a2f2f7472617669732d63692e6f72672f6d786c2f6c61726176656c2d6170692d6b65792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/mxl/laravel-api-key)

API Key Authorization for Laravel with replay attack prevention

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

[](#installation)

```
$ composer require mxl/laravel-api-key
```

How it works?
-------------

[](#how-it-works)

Both sides (i.e. client and server) have a secret key. Client calculates a token - hash value for concatenated secret key and current timestamp. The Token and the timestamp are sent with request to server as separate HTTP headers. Server recalculates hash value and validates the token by comparing it with this value and by checking that received timestamp belongs to current time ± window interval.

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

[](#configuration)

Package uses default configuration from `vendor/laravel-api-key/config/apiKey.php`:

```
