PHPackages                             endropie/lumen-micro-serve - 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. endropie/lumen-micro-serve

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

endropie/lumen-micro-serve
==========================

v0.1.6(4y ago)015MITPHP

Since Feb 12Pushed 4y ago1 watchersCompare

[ Source](https://github.com/endropie/lumen-micro-serve)[ Packagist](https://packagist.org/packages/endropie/lumen-micro-serve)[ RSS](/packages/endropie-lumen-micro-serve/feed)WikiDiscussions master Synced yesterday

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

lumen-micro-serve
=================

[](#lumen-micro-serve)

Simple microservice for Lumen Framework.

- Authentication on Auth-Service.
- Authorization on other services.
- Model Filterable \[soon\].
- Model JSON resource \[soon\].

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

[](#installation)

Standard [Composer](https://getcomposer.org/download) package installation:

```
composer require Endropie/LumenMicroServe
```

Usage
-----

[](#usage)

### Authentication on Auth-Service

[](#authentication-on-auth-service)

1. Publish the config file. This will create a `config/jwt.php` file for basic configuration options.

```
php artisan vendor:publish --provider="Endropie\LumenMicroserve\AuthServiceProvider" --tag="config"
```

2. Add a new auth guard to your auth config file using a `jwt` driver.

```
// config/auth.php

'guards' => [
	'web' => [
		'driver' => 'session',
		'provider' => 'users',
	],

	'api' => [
		'driver' => 'jwt',
		'provider' => 'users',
	],
],

'providers' => [
    'users' => [
        'driver' => 'eloquent',
        // Model eloquent for auth user provider
        'model' => App\Models\User::class,
    ],
],
```

3. Protect your API routes using this new guard.

```
$router->group(['middleware' => 'auth'], function () use ($router) {
    $router->get('/user', function() {
        return auth()->user()->toArray();
    });
});
```

4. Use provided `AuthorizableToken` trait from this package on your Auth model (eg. User).

```
namespace App\Models;

use Endropie\LumenMicroServe\Auth\Concerns\AuthorizableToken;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
	use Notifiable, AuthorizableToken;
}
```

You now have access to `token()` method on your User model, eg:

```
$user = User::findOrFail(1);
$user->token();
```

You should probably return this token via Login Controller or User Resource.

### Authorization on other services.

[](#authorization-on-other-services)

1. Publish the config file. This will create a `config/jwt.php` file for basic configuration options.

```
php artisan vendor:publish --provider="Endropie\LumenMicroserve\AuthTokenServiceProvider" --tag="config"
```

2. Protect your API routes using this new guard.

```
$router->group(['middleware' => 'auth'], function () use ($router) {
    $router->get('/user', function() {
        return auth()->user()->toArray();
    });
});
```

You now have access to `auth()` helper function, eg:

```
	auth()->user();
```

You should probably return this token via Login Controller or User Resource.

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

[](#configuration)

This package provides simple configuration via `config/jwt.php` file after you publish the config. Let's go over each configuration option.

- `secret-key` - Secret key to use when encoding / decoding tokens. It should be a random string. Remember, if you change this key all active JWT tokens will be invalidated.
- `hash-algo` - Hashing algorithm. List of supported ones are in the config file. You probably don't need to change this.
- `expiration` - Default token expiration time in minutes. You can set it to `null` and the tokens will never expire.
- `claims` - Default claims that will be applied to all tokens (besides the required ones needed for decoding and validation).

This was global configuration for all tokens. Besides that, library provides a local per-model configuration via `HasJwt` trait helper methods.

- `getJwtId()` - It should return the model unique key used to retrieve that model from database. It defaults to model primary key.
- `getJwtValidFromTime()` - It should return `null` (default) or a Carbon instance. You can use that if you want to create tokens which are not active right away.
- `getJwtValidUntilTime()` - It should return `null` or a Carbon instance. This sets the JWT expiration time which, by default, uses the `expiration` option from the config file.
- `getJwtCustomClaims()` - Should return a key/value array of extra custom claims that you want to be a part of your token. By default it's an empty array.

You can also use configuration directly on the `token()` method which then overrides all other configurations, eg:

```
$user->token([
	'id' => $user->email,
	'valid_from' => now()->addHour(),
	'valid_until' => now()->addDay(),
	'claims' => [
		'extra1' => 'foo',
		'extra2' => 'bar'
	]
]);
```

You don't need to override all configuration options, just the ones that you wish to change.

Request
-------

[](#request)

Token is extracted from the request in one of three ways:

1. From `Authorization: Bearer {token}` header (most common).
2. From URL query param `token`.
3. From request payload using `token` field name.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity44

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

7

Last Release

1538d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0cae55cbf8fa9f084ed217384480865eee23dbc635b21930740c58b22ec36727?d=identicon)[endropie](/maintainers/endropie)

---

Top Contributors

[![endropie](https://avatars.githubusercontent.com/u/15966844?v=4)](https://github.com/endropie "endropie (9 commits)")

### Embed Badge

![Health badge](/badges/endropie-lumen-micro-serve/health.svg)

```
[![Health](https://phpackages.com/badges/endropie-lumen-micro-serve/health.svg)](https://phpackages.com/packages/endropie-lumen-micro-serve)
```

###  Alternatives

[laravel/passport

Laravel Passport provides OAuth2 server support to Laravel.

3.4k85.0M532](/packages/laravel-passport)[laravel/pulse

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

1.7k12.1M99](/packages/laravel-pulse)[aedart/athenaeum

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

255.2k](/packages/aedart-athenaeum)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[psalm/plugin-laravel

Psalm plugin for Laravel

3274.9M308](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)

PHPackages © 2026

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