PHPackages                             kroderdev/laravel-microservice-core - 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. [Framework](/categories/framework)
4. /
5. kroderdev/laravel-microservice-core

ActiveLibrary[Framework](/categories/framework)

kroderdev/laravel-microservice-core
===================================

Laravel package providing JWT authentication, RBAC, distributed tracing, and multi-service HTTP client for microservice architectures.

v0.5.1(1mo ago)5150[2 issues](https://github.com/KroderDev/laravel-microservice-core/issues)[5 PRs](https://github.com/KroderDev/laravel-microservice-core/pulls)MITPHPPHP &gt;=8.2CI passing

Since Jun 17Pushed 1w agoCompare

[ Source](https://github.com/KroderDev/laravel-microservice-core)[ Packagist](https://packagist.org/packages/kroderdev/laravel-microservice-core)[ RSS](/packages/kroderdev-laravel-microservice-core/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (10)Versions (32)Used By (0)

Laravel Microservice Core
=========================

[](#laravel-microservice-core)

[![Packagist Version](https://camo.githubusercontent.com/79756d630578e30f846334286bfa8f53d09e90acccde77e22ba9b10a0fcbefc5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b726f6465726465762f6c61726176656c2d6d6963726f736572766963652d636f72652e737667)](https://packagist.org/packages/kroderdev/laravel-microservice-core)[![Downloads](https://camo.githubusercontent.com/2936cb43f5112b5e47c5ca19e92786c469b8c6510426383b44a3efedef9c48cb/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b726f6465726465762f6c61726176656c2d6d6963726f736572766963652d636f72652e737667)](https://packagist.org/packages/kroderdev/laravel-microservice-core)[![License](https://camo.githubusercontent.com/afa4d87d0480489cd8e1c775b3d5c3e71c11df6981fcb3819a75a6b013e23c4b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b726f6465726465762f6c61726176656c2d6d6963726f736572766963652d636f72652e737667)](LICENSE)

A **Laravel package** that provides the infrastructure to build and operate services in a **distributed architecture**. It delivers JWT authentication, role-based authorization, distributed request tracing, and a multi-service HTTP client — so you can focus on your service logic instead of boilerplate.

Key Features
------------

[](#key-features)

- **JWT authentication middleware** with RSA/ECDSA/EdDSA support via public key or JWKS (Keycloak-ready)
- **OpenID Connect integration** for role and permission extraction from token claims
- **Role and permission middleware** with Laravel Gate integration (`role:`, `permission:` prefixes)
- **Multi-service HTTP client** with configurable service registry, correlation ID propagation, timeout, and retry
- **Distributed request tracing** via correlation IDs (W3C Trace Context and OpenTelemetry on the roadmap)
- **Health check endpoint** out of the box

Quick start
-----------

[](#quick-start)

Install the package via Composer:

```
composer require kroderdev/laravel-microservice-core
```

Publish the configuration to customize defaults:

```
php artisan vendor:publish --provider="Kroderdev\LaravelMicroserviceCore\Providers\MicroserviceServiceProvider"
```

Basic usage
-----------

[](#basic-usage)

### Service communication

[](#service-communication)

Configure your services in `config/microservice.php` under `services.registry`:

```
'services' => [
    'registry' => [
        'gateway' => [
            'url' => env('API_GATEWAY_URL', 'http://gateway.local'),
            'timeout' => 5,
            'retries' => 2,
        ],
        'users' => [
            'url' => env('USERS_SERVICE_URL'),
            'timeout' => 10,
            'retries' => 3,
        ],
    ],
],
```

Then call any registered service using HTTP macros or the `ServiceClient`:

```
use Kroderdev\LaravelMicroserviceCore\Services\ServiceClient;
use Illuminate\Support\Facades\Http;

// Via HTTP macro (auto-attaches correlation ID)
$response = Http::service('users')->get('/api/users');
$response = Http::service('gateway')->post('/auth/login', $credentials);

// With a bearer token
$response = Http::serviceWithToken('users', $token)->get('/api/profile');

// Via ServiceClient (instance methods)
$client = ServiceClient::to('users');
$client->withToken($token);
$users = $client->get('/api/users');
```

### JWT authentication

[](#jwt-authentication)

Add the provided middleware to your routes:

```
use Kroderdev\LaravelMicroserviceCore\Http\Middleware\ValidateJwt;
use Kroderdev\LaravelMicroserviceCore\Http\Middleware\LoadAccess;

// Individual middleware
Route::middleware(['jwt.auth'])->group(function () {
    Route::get('/profile', fn () => 'ok');
});

// Convenience group (JWT validation + permission loading)
Route::middleware(['microservice.auth'])->group(function () {
    Route::get('/dashboard', fn () => view('dashboard'));
});
```

### Role and permission middleware

[](#role-and-permission-middleware)

```
Route::middleware(['jwt.auth', 'load.access', 'role:admin'])->group(function () {
    Route::get('/admin', fn () => 'admin area');
});

Route::middleware(['jwt.auth', 'load.access', 'permission:posts.create'])->group(function () {
    Route::post('/posts', [PostController::class, 'store']);
});
```

### Gate authorization

[](#gate-authorization)

```
Gate::allows('role:admin');
Gate::allows('permission:posts.create');
```

### Health check

[](#health-check)

Enabled by default at `GET /health`. Configure or disable in `config/microservice.php`:

```
'health' => [
    'enabled' => true,
    'path' => '/health',
],
```

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

[](#documentation)

Full documentation lives in the [project wiki](https://github.com/KroderDev/laravel-microservice-core/wiki).

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

[](#contributing)

Contributions welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

License
-------

[](#license)

This project is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

43

—

FairBetter than 89% of packages

Maintenance86

Actively maintained with recent releases

Popularity15

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93% 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 ~18 days

Recently: every ~89 days

Total

22

Last Release

50d ago

PHP version history (2 changes)v0.0.1PHP &gt;=8.1

v0.5.1PHP &gt;=8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/18111250989b4d45b04aa8aff960bcaea47e6813a171a44679bd629d7c3eac40?d=identicon)[KroderDev](/maintainers/KroderDev)

---

Top Contributors

[![KroderDev](https://avatars.githubusercontent.com/u/142845401?v=4)](https://github.com/KroderDev "KroderDev (147 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")

---

Tags

correlationdistributed-systemshealth-checkjwt-authenticationlaravellaravel-packagemicroservicesmiddleware-libraryopenid-connectrbac-authorizationservice-client

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/kroderdev-laravel-microservice-core/health.svg)

```
[![Health](https://phpackages.com/badges/kroderdev-laravel-microservice-core/health.svg)](https://phpackages.com/packages/kroderdev-laravel-microservice-core)
```

###  Alternatives

[laravel/socialite

Laravel wrapper around OAuth 1 &amp; OAuth 2 libraries.

5.7k113.1M998](/packages/laravel-socialite)[laravel/ai

The official AI SDK for Laravel.

1.1k4.6M323](/packages/laravel-ai)

PHPackages © 2026

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