From 244bf08a39097c6b35a07894664643715793c38f Mon Sep 17 00:00:00 2001 From: Gary Renes Date: Tue, 25 Jan 2022 19:25:49 +0000 Subject: [PATCH] Minor fixes * Display UTF-8 characters correctly in the browser, also shows how to add headers to responses * Add command to create empty composer.json before running require (stops potential prompts about the file being missing) --- README.md | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 8c6a923..9da9d7b 100644 --- a/README.md +++ b/README.md @@ -25,16 +25,18 @@ $app = new FrameworkX\App(); $app->get('/', function () { return new React\Http\Message\Response( - 200, - [], + 200, [ + "Content-Type" => "text/plain; charset=UTF-8" + ], "Hello wörld!\n" ); }); $app->get('/users/{name}', function (Psr\Http\Message\ServerRequestInterface $request) { return new React\Http\Message\Response( - 200, - [], + 200, [ + "Content-Type" => "text/plain; charset=UTF-8" + ], "Hello " . $request->getAttribute('name') . "!\n" ); }); @@ -43,7 +45,14 @@ $app->run(); ``` Next, we need to install X and its dependencies to actually run this project. -In your project directory, simply run the following command: +In your project directory, simply run the following commands: + +```bash +$ composer init +``` + +This will create an empty `composer.json` file. Just press return a few times +to accept the default answers to any prompts when asked, and then run: ```bash $ composer require clue/framework-x:dev-main