{"id":20535014,"url":"https://github.com/jhuntdev/blest-php","last_synced_at":"2026-02-08T09:05:24.339Z","repository":{"id":178085621,"uuid":"656317478","full_name":"jhuntdev/blest-php","owner":"jhuntdev","description":"The PHP reference implementation of BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST.","archived":false,"fork":false,"pushed_at":"2024-12-29T17:51:20.000Z","size":104,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-20T05:08:10.790Z","etag":null,"topics":["api","blest","leaf","php","slim"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jhuntdev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-20T17:45:58.000Z","updated_at":"2024-12-29T17:51:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"102396df-2bb2-4acf-a58b-0245e70a95db","html_url":"https://github.com/jhuntdev/blest-php","commit_stats":null,"previous_names":["jhuntdev/blest-php"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/jhuntdev/blest-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jhuntdev","download_url":"https://codeload.github.com/jhuntdev/blest-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jhuntdev%2Fblest-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29225729,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T06:05:31.539Z","status":"ssl_error","status_checked_at":"2026-02-08T05:58:33.853Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","blest","leaf","php","slim"],"created_at":"2024-11-16T00:28:57.126Z","updated_at":"2026-02-08T09:05:24.324Z","avatar_url":"https://github.com/jhuntdev.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BLEST PHP\n\nThe PHP reference implementation of BLEST (Batch-able, Lightweight, Encrypted State Transfer), an improved communication protocol for web APIs which leverages JSON, supports request batching by default, and provides a modern alternative to REST. It includes examples for Leaf, Slim, and OpenSwoole.\n\nTo learn more about BLEST, please visit the website: https://blest.jhunt.dev\n\nFor a front-end implementation in Vue, please visit https://github.com/jhuntdev/blest-vue\n\n## Features\n\n- Built on JSON - Reduce parsing time and overhead\n- Request Batching - Save bandwidth and reduce load times\n- Compact Payloads - Save even more bandwidth\n- Single Endpoint - Reduce complexity and facilitate introspection\n- Fully Encrypted - Improve data privacy\n\n## Installation\n\nInstall BLEST PHP with Composer.\n\n```bash\ncomposer require blest/blest\n```\n\n## Usage\n\n### Router\n\nThis example uses Slim, but you can find examples with other frameworks [here](examples).\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse Psr\\Http\\Message\\ResponseInterface as Response;\nuse Psr\\Http\\Message\\ServerRequestInterface as Request;\nuse Slim\\Middleware\\BodyParsingMiddleware;\nuse Slim\\Factory\\AppFactory;\nuse BLEST\\BLEST\\Router;\n\n// Instantiate the router\n$router = new Router();\n\n// Create some middleware (optional)\n$userMiddleware = function($body, $context) {\n  $context['user'] = [\n    // user info for example\n  ];\n};\n$app-\u003euse($userMiddleware);\n\n// Create a route controller\n$greetController = function($body, $context) {\n  return [\n    'greeting' =\u003e 'Hi, ' . $body['name]' . '!'\n  ];\n};\n$app-\u003eroute('greet', $greetController);\n\n// Create the Slim app\n$app = AppFactory::create();\n\n// Parse request body\n$app-\u003eaddBodyParsingMiddleware();\n\n// Listen for POST requests on root URL (\"/\")\n$app-\u003epost('/', function (Request $request, Response $response) use ($requestHandler) {\n  $body = $request-\u003egetParsedBody();\n  $context = [\n    'httpHeaders' =\u003e $request-\u003egetHeaders()\n  ];\n  [$result, $error] = $router-\u003ehandle($body, $context);\n  if ($error) {\n    $response-\u003egetBody()-\u003ewrite(json_encode($error));\n    return $response-\u003ewithHeader('Content-Type', 'application/json')-\u003ewithStatus(500);\n  } else {\n    $response-\u003egetBody()-\u003ewrite(json_encode($result));\n    return $response-\u003ewithHeader('Content-Type', 'application/json')-\u003ewithStatus(200);\n  }\n});\n\n// Run the app\n$app-\u003erun();\n```\n\n### HttpClient\n\n```php\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse BLEST\\BLEST\\HttpClient;\n\n// Create an HTTP client\n$client = new HttpClient('http://localhost:8080', [\n  'httpHeaders' =\u003e [\n    'Authorization' =\u003e 'Bearer token'\n  ]\n]);\n\n// Use the client to make a request\n$client-\u003erequest('greet', ['name' =\u003e 'Steve']);\n```\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhuntdev%2Fblest-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjhuntdev%2Fblest-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjhuntdev%2Fblest-php/lists"}