dumbo/examples/compress/index.php
Imam Ali Mustofa b558a2b1ef
feat: dumbo compress helper (#38)
* refactor: add missing response interface

* feat(compress): adding compress helper

* Apply suggestions from code review

Co-authored-by: Jamie Barton <jamie@notrab.dev>

* refactor: add brotli compress suggestion

* revert brotli for now

---------

Co-authored-by: Jamie Barton <jamie@notrab.dev>
2024-09-04 14:16:46 +01:00

22 lines
390 B
PHP

<?php
require "vendor/autoload.php";
use Dumbo\Dumbo;
use Dumbo\Helpers\Compress;
$app = new Dumbo();
$app->use(
Compress::compress([
"threshold" => 1024, // Minimum size to compress (bytes)
"encoding" => "gzip", // Preferred encoding (gzip or deflate)
])
);
$app->get("/", function ($c) {
return $c->json(["message" => "Hello, Dumbo!"]);
});
$app->run();