mirror of
https://github.com/notrab/dumbo.git
synced 2025-01-17 06:08:31 +01:00
712 B
712 B
Dumbo
A lightweight, friendly PHP framework for HTTP — inspired by Hono.
Install
composer require notrab/dumbo
Quickstart
<?php
use Dumbo\Dumbo;
$app = new Dumbo();
$app->get("/", function ($c) {
return $c->text("Welcome to Dumbo!");
});
$app->get("/json", function ($c) {
return $c->json(["message" => "Hello from Dumbo!"]);
});
$app->get("/user/:name", function ($c) {
$name = $c->param("name");
return $c->text("Hello, $name!");
});
$app->get("/greet/:greeting/:name", function ($c) {
$greeting = $c->param("greeting");
$name = $c->param("name");
return $c->json([
"message" => "$greeting, $name!",
]);
});
$app->run();