dumbo/README.md
2024-07-15 14:27:57 +01:00

714 B

Dumbo

A lightweight, friendly PHP framework for HTTP — inspired by Hono.

Install

composer require yourname/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();