desilva/microserve
MicroServe is a Laravel package for building and organizing microservice-based applications. It offers a lightweight structure for separating services while keeping Laravel conventions, helping teams develop, scale, and maintain distributed PHP systems more easily.
composer require desilva/microserve — check composer.json first for the required PHP version and whether it pulls in ReactPHP (it does the event-loop work under the hood; you are not writing against PHP-FPM).src/. The package is small enough that the source is the documentation: identify the app/server class, the router, and the request/response objects before writing anything real.public/index.php. Your entry point is a server.php you run with php server.php.curl. Do not port a Laravel route file to it on day one.Typical skeleton (confirm class names against the actual source — the API surface is tiny and drifts between 0.x releases):
require __DIR__ . '/vendor/autoload.php';
$app = new Desilva\MicroServe\App(); // check README for the real entry class
$app->get('/', function ($req, $res) {
return $res->json(['ok' => true]);
});
$app->listen(8080);
auth → validate → handler), where each function either returns a response or delegates to the next. Keep the chain explicit so you can read it top to bottom.config() helper and no .env loader — use vlucas/phpdotenv explicitly if you want one. Read config once at boot, not per request.storage/logs from a separate process unless you wire a Monolog channel deliberately.supervisorctl restart microserve on every deploy; opcache and any in-memory state persist otherwise.routes/ auto-discovery, no artisan integration. You own server.php, the supervisor unit, and the nginx proxy config.sleep(), synchronous Guzzle call, or remote file_get_contents blocks the entire event loop and stalls every other request. Use async HTTP clients or offload heavy work to a queue/worker.$_GET, $_POST, $_SERVER are not the request. Read from the package's Request object. Libraries (and some Laravel helpers) that inspect superglobals will silently misbehave.var_dump inside a handler prints to the terminal running the server, not the HTTP response. Wrap handlers in try/catch — depending on version, an uncaught exception can drop the connection or take down the process.How can I help you explore Laravel packages today?