A toolkit to use Laravel effectively as a microservice in a distributed architecture.
kroderdev/laravel-microservice-core is a Laravel package for a toolkit to use laravel effectively as a microservice in a distributed architecture..
It currently has 6 GitHub stars and 150 downloads on Packagist (latest version v0.5.0).
Install it with composer require kroderdev/laravel-microservice-core.
Discover more Laravel packages by kroderdev
or browse all Laravel packages to compare alternatives.
Last updated
A Laravel package that simplifies building microservices in distributed architectures. It provides authentication, request handling, and service-to-service communication tools to make Laravel scalable and production-ready in microservice environments.
This package packages common microservice concerns so you can focus on your service logic:
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"
Configure your API gateway URL and JWT settings in config/microservice.php.
Then extend the base model to interact with remote resources:
Scaffold your remote model via the new Artisan command:
php artisan make:model RemoteUser --remote
This will generate a RemoteUser model that extends the core Model class with remote-resource support.
use Kroderdev\LaravelMicroserviceCore\Models\Model;
class RemoteUser extends Model
{
protected static string $endpoint = '/users';
protected $fillable = ['id', 'name'];
}
$users = RemoteUser::all();
Add the provided middleware to your routes to validate JWTs and propagate correlation IDs:
Route::middleware(['jwt.auth'])->group(function () {
Route::get('/profile', fn () => 'ok');
});
Full documentation lives in the project wiki.
Contributions welcome! See CONTRIBUTING.md for guidelines.
This project is open-sourced software licensed under the MIT license.