PHPackages                             kolayik/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. kolayik/auth

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

kolayik/auth
============

Kolay Auth

v2.2.0(4mo ago)121.9k1PHPPHP ^7.3|^8.0|^8.1|^8.2|^8.3CI passing

Since Mar 26Pushed 4mo ago15 watchersCompare

[ Source](https://github.com/kolayik/auth)[ Packagist](https://packagist.org/packages/kolayik/auth)[ RSS](/packages/kolayik-auth/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (9)Dependencies (18)Versions (18)Used By (0)

Documentation
-------------

[](#documentation)

For version `dev-master` See the below for documentation.

---

### Installation

[](#installation)

To install this package you will need:

- Laravel 4 or 5
- PHP 5.4 +

Install package via composer require

```
composer require kolayik/auth:dev-master

```

or edit your composer.json

```
"require": {

    "kolayik/auth": "dev-master"
}

```

Then run composer update in your terminal to pull it in.

Once this has finished, you will need to add the service provider to the providers array in your app.php config as follows:

```
KolayIK\Auth\Providers\LaravelServiceProvider::class

```

Finally, you will want to publish the config and migration file using the following command:

**Laravel 5:**

```
$ php artisan vendor:publish --provider="KolayIK\Auth\Providers\LaravelServiceProvider"

```

### Configuration

[](#configuration)

Open `.env` file and change according to your request.

Token time to live - KOLAY\_AUTH\_TTL

Storage - KOLAY\_AUTH\_DRIVER

```
KOLAY_AUTH_DRIVER:"database" or "cache"

KOLAY_AUTH_TTL:1440

```

### Quick Start

[](#quick-start)

How do generate a custom token ?

```
use KolayIK\Auth\Facades\KolayAuth;

class AuthenticateController extends Controller
{
    public function authenticate(Request $request)
    {
        // your add custom login code
        $userId = "kolayik";

        return response()->json(KolayAuth::generate($userId));
    }
}

```

How do authenticate via token in custom middleware ?

```
    namespace App\Http\Middleware;
    use KolayIK\Auth\Facades\KolayAuth;

    class CustomAuth
    {
        public function handle($request, Closure $next)
        {
            $token = KolayAuth::authenticate();

            if ($token->isExpired()) {
                throw new \Exception('Session expired!');
            }

            return $next($request);
        }
    }

```

### Authentication

[](#authentication)

To make authenticated requests via http using the built in methods, you will need to set an authorization header as follows:

```
Authorization: Bearer {yourtoken}

```

**Note to Apache users**

Apache seems to discard the Authorization header if it is not a base64 encoded user/pass combo. So to fix this you can add the following to your apache config

```
RewriteEngine On
RewriteCond %{HTTP:Authorization} ^(.*)
RewriteRule .* - [e=HTTP_AUTHORIZATION:%1]

```

Alternatively you can include the token `via a query string`

```
http://api.mysite.com/me?authorization_key={yourtoken}

```

To get the token from the request you can do:

```
$token = KolayAuth::getToken();

```

**Middleware**

You can use `kolay.auth` middleware:

```
Route::group(['prefix' => '/api/v1', 'middleware' => 'kolay.auth'], function () {
    //your code
});

```

License
-------

[](#license)

The MIT License (MIT)

###  Health Score

55

—

FairBetter than 97% of packages

Maintenance74

Regular maintenance activity

Popularity23

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity87

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~311 days

Recently: every ~376 days

Total

10

Last Release

143d ago

Major Versions

v0.11 → v1.0.02021-05-24

v1.0.0 → v2.0.12022-02-07

PHP version history (6 changes)0.9PHP &gt;=5.5.9

v0.10.0PHP ^7.2.5

v0.11PHP ^7.3

v2.0.1PHP &gt;=7.3

v2.0.2PHP ^7.3|^8.0|^8.1

v2.2.0PHP ^7.3|^8.0|^8.1|^8.2|^8.3

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/37627645?v=4)[Hakan Taşkın](/maintainers/kolay-hakan)[@kolay-hakan](https://github.com/kolay-hakan)

---

Top Contributors

[![kolay-hakan](https://avatars.githubusercontent.com/u/37627645?v=4)](https://github.com/kolay-hakan "kolay-hakan (6 commits)")[![koushamad](https://avatars.githubusercontent.com/u/20081351?v=4)](https://github.com/koushamad "koushamad (4 commits)")[![aliihsansepar](https://avatars.githubusercontent.com/u/38309817?v=4)](https://github.com/aliihsansepar "aliihsansepar (4 commits)")[![gizemsevinc](https://avatars.githubusercontent.com/u/4912013?v=4)](https://github.com/gizemsevinc "gizemsevinc (1 commits)")[![MortezaPoussaneh](https://avatars.githubusercontent.com/u/49806042?v=4)](https://github.com/MortezaPoussaneh "MortezaPoussaneh (1 commits)")[![3nitro](https://avatars.githubusercontent.com/u/3616346?v=4)](https://github.com/3nitro "3nitro (1 commits)")[![nurettintopal](https://avatars.githubusercontent.com/u/1067132?v=4)](https://github.com/nurettintopal "nurettintopal (1 commits)")[![efecan](https://avatars.githubusercontent.com/u/699381?v=4)](https://github.com/efecan "efecan (1 commits)")[![freddie-kousha](https://avatars.githubusercontent.com/u/300220058?v=4)](https://github.com/freddie-kousha "freddie-kousha (1 commits)")

---

Tags

composerlaravelphp5jwtlaravelJSON Web Tokenlaravel-jwt-auth

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kolayik-auth/health.svg)

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

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.4M354](/packages/psalm-plugin-laravel)[php-open-source-saver/jwt-auth

JSON Web Token Authentication for Laravel and Lumen

84511.6M67](/packages/php-open-source-saver-jwt-auth)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

79227.1M218](/packages/laravel-mcp)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k12.2M126](/packages/nuwave-lighthouse)[illuminate/auth

The Illuminate Auth package.

9328.5M1.3k](/packages/illuminate-auth)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k16.3M153](/packages/laravel-pulse)

PHPackages © 2026

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