PHPackages                             unquam/nette-api-auth - 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. unquam/nette-api-auth

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

unquam/nette-api-auth
=====================

REST API authentication for Nette Framework. Token auth, rate limiting, refresh tokens, CORS and scopes - zero boilerplate.

v1.0.1(3w ago)07MITPHPPHP &gt;=7.4CI passing

Since May 11Pushed 3w agoCompare

[ Source](https://github.com/Unquam/nette-api-auth)[ Packagist](https://packagist.org/packages/unquam/nette-api-auth)[ RSS](/packages/unquam-nette-api-auth/feed)WikiDiscussions main Synced 1w ago

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

Nette API Auth
==============

[](#nette-api-auth)

[![Latest Version](https://camo.githubusercontent.com/f4133737afd6651098139b41bc1ad3bbe24d613aa084ecd963dcb7960dcadb89/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f756e7175616d2f6e657474652d6170692d617574682e737667)](https://packagist.org/packages/unquam/nette-api-auth)[![PHP Version](https://camo.githubusercontent.com/d925c4a410ec77c3ecaf7c11e5fedbb4601ed4476ffe6fdb79b13cb9131c50c4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f756e7175616d2f6e657474652d6170692d617574682e737667)](https://packagist.org/packages/unquam/nette-api-auth)[![Downloads](https://camo.githubusercontent.com/87e7d91261e4b279b3ba507ba991888c66a3ef586d1de2e7d740efb8d38b69b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f756e7175616d2f6e657474652d6170692d617574682e737667)](https://packagist.org/packages/unquam/nette-api-auth)[![License](https://camo.githubusercontent.com/1fb1a532fac6667a694c173bf355a77ad16c182749bed7c239d5e09550e7bfed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f756e7175616d2f6e657474652d6170692d617574682e737667)](https://packagist.org/packages/unquam/nette-api-auth)[![Tests](https://github.com/Unquam/nette-api-auth/actions/workflows/tests.yml/badge.svg)](https://github.com/Unquam/nette-api-auth/actions/workflows/tests.yml)

Nette API Auth is a straightforward API token authentication package for the Nette Framework. It was built because the Nette ecosystem lacked a solid, ready-to-use solution for token-based API authentication. Forking and adapting it to your own needs is very much welcome.

Requirements
------------

[](#requirements)

PHP 7.4 or higher, Nette Framework 3.0, 3.1 or 3.2, and Nette Database 3.0, 3.1 or 3.2.

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

[](#installation)

```
composer require unquam/nette-api-auth
```

Database Setup
--------------

[](#database-setup)

The package uses a separate `api_users` table to keep API authentication completely independent from your web authentication. Run the migration files in order - `api_users` must be created first because the other tables reference it.

Migrations are written for MySQL/MariaDB. If you use PostgreSQL or another database, use the table structure below as a reference and create migrations with your preferred tool.

```
mysql -u root -p your_database
