You’re reading the v0.1 development preview. APIs may change.
~ 1 min readUpdated 2026-10-29

Hello, JSON

A complete route with a named parameter and a JSON response.

Route

use Elang\Http\Response;
$router->get('/api/hello/{name}', function (string $name) {
    return Response::json(['message' => 'Hello, '.$name.'!']);
}, 'hello');

Request

curl http://127.0.0.1:8000/api/hello/Ada

Response

{"message":"Hello, Ada!"}

Route parameters are injected by name. For constrained values, add a route requirement and use the appropriate PHP type.

Need a hand?

Check the troubleshooting guide, look up a term in the glossary, or work through the complete task board project.

Search Elang documentation

Start typing to find your next step.