PHPackages                             antarctica/laravel-token-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. antarctica/laravel-token-auth

ActiveLibrary

antarctica/laravel-token-auth
=============================

Enables use of API tokens as a form of stateless authentication within Laravel

v0.1.1(11y ago)27611MITPHPPHP &gt;=5.4.0

Since Jan 8Pushed 11y ago2 watchersCompare

[ Source](https://github.com/antarctica/laravel-token-auth)[ Packagist](https://packagist.org/packages/antarctica/laravel-token-auth)[ RSS](/packages/antarctica-laravel-token-auth/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (3)Used By (1)

Laravel Token Auth
==================

[](#laravel-token-auth)

Enables use of API tokens as a form of stateless authentication within Laravel.

This package is designed not to rely on any particular Token or Token Blacklist implementation, however by default the [tymondesigns/jwt-auth](https://github.com/tymondesigns/jwt-auth) package is used to provide a JWT based Token implementation and the `antarctica/laravel-token-blacklist` package is used to provided a default Token Blacklist implementation.

It is possible to provide your own implementations for managing tokens and/or blacklisting them. See the *custom implementations* section for details.

Installing
----------

[](#installing)

Require this package in your `composer.json` file:

```
{
    "require": {
        "antarctica/laravel-token-auth": "0.1.*"
    }
}
```

Run `composer update`.

Register the service provider in the `providers` array of your `app/config/app.php` file:

```
'providers' => array(
	Antarctica\LaravelTokenAuth\LaravelTokenAuthServiceProvider,
)
```

This package uses a Repository through which users can be retrieved. There is NO default implementation for this repository included in this package. You MUST therefore provide an implementation that implements the provided interface through this package's config file.

To publish the config file run:

```
php artisan config:publish antarctica/laravel-token-auth
```

Then edit the `user_repository` key.

Usage
-----

[](#usage)

To support both standard session based and token based authentication this package provides an `auth.combined` filter.

To enable this filter add the following to your `app/filters.php` file:

```
/*
|--------------------------------------------------------------------------
| Custom Authentication Filters
|--------------------------------------------------------------------------
|
| The "combined" filter is a custom filter which allows session and token
| based authentication to be combined. This means a user can be authenticated
| using either an active session (i.e. being logged in) or by providing a
| token (i.e. using the Authorization header).
|
*/

Route::filter('auth.combined', 'Antarctica\LaravelTokenAuth\Filter\AuthFilter');
```

To use the filter on a route:

```
Route::get('/secret', array('before' => 'auth.combined', function()
{
    	return Response::json(['message' => 'Yay you get to know the secret']);
}));
```

Contributing
------------

[](#contributing)

This project welcomes contributions, see `CONTRIBUTING` for our general policy.

Developing
----------

[](#developing)

To aid development and keep your local computer clean, a VM (managed by Vagrant) is used to create an isolated environment with all necessary tools/libraries available.

### Requirements

[](#requirements)

- Mac OS X
- Ansible `brew install ansible`
- [VMware Fusion](http://vmware.com/fusion)
- [Vagrant](http://vagrantup.com) `brew cask install vmware-fusion vagrant`
- [Host manager](https://github.com/smdahlen/vagrant-hostmanager) and [Vagrant VMware](http://www.vagrantup.com/vmware) plugins `vagrant plugin install vagrant-hostmanager && vagrant plugin install vagrant-vmware-fusion`
- You have a private key `id_rsa` and public key `id_rsa.pub` in `~/.ssh/`
- You have an entry like \[1\] in your `~/.ssh/config`

\[1\] SSH config entry

```
Host bslweb-*
    ForwardAgent yes
    User app
    IdentityFile ~/.ssh/id_rsa
    Port 22
```

### Provisioning development VM

[](#provisioning-development-vm)

VMs are managed using Vagrant and configured by Ansible.

```
$ git clone ssh://git@stash.ceh.ac.uk:7999/basweb/laravel-token-auth.git
$ cp ~/.ssh/id_rsa.pub laravel-token-auth/provisioning/public_keys/
$ cd laravel-token-auth
$ ./armadillo_standin.sh

$ vagrant up

$ ssh bslweb-laravel-token-auth-dev-node1
$ cd /app

$ composer install

$ logout
```

### Committing changes

[](#committing-changes)

The [Git flow](https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow) workflow is used to manage development of this package.

Discrete changes should be made within *feature* branches, created from and merged back into *develop* (where small one-line changes may be made directly).

When ready to release a set of features/changes create a *release* branch from *develop*, update documentation as required and merge into *master* with a tagged, [semantic version](http://semver.org/) (e.g. `v1.2.3`).

After releases the *master* branch should be merged with *develop* to restart the process. High impact bugs can be addressed in *hotfix* branches, created from and merged into *master* directly (and then into *develop*).

### Issue tracking

[](#issue-tracking)

Issues, bugs, improvements, questions, suggestions and other tasks related to this package are managed through the BAS Web &amp; Applications Team Jira project ([BASWEB](https://jira.ceh.ac.uk/browse/BASWEB)).

### Clean up

[](#clean-up)

To remove the development VM:

```
vagrant halt
vagrant destroy
```

The `laravel-token-auth` directory can then be safely deleted as normal.

License
-------

[](#license)

Copyright 2015 NERC BAS. Licensed under the MIT license, see `LICENSE` for details.

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

2

Last Release

4141d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cf29a08b30c4f568f3b00f16bdb420ad2bc14efa856cf9e50f137216abf1682?d=identicon)[felnne](/maintainers/felnne)

---

Top Contributors

[![felnne](https://avatars.githubusercontent.com/u/7847612?v=4)](https://github.com/felnne "felnne (24 commits)")

### Embed Badge

![Health badge](/badges/antarctica-laravel-token-auth/health.svg)

```
[![Health](https://phpackages.com/badges/antarctica-laravel-token-auth/health.svg)](https://phpackages.com/packages/antarctica-laravel-token-auth)
```

###  Alternatives

[fumeapp/modeltyper

Generate TypeScript interfaces from Laravel Models

196277.9k](/packages/fumeapp-modeltyper)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
