From 5378d1251df880f805cba35f75f1ed0a2f03e886 Mon Sep 17 00:00:00 2001 From: Eugene Dorfman Date: Wed, 15 May 2024 15:01:23 +0200 Subject: [PATCH 1/2] doc: improve examples guidance addressing #55 --- examples/cloud/gettingStartedConsole.php | 2 +- readme.md | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/examples/cloud/gettingStartedConsole.php b/examples/cloud/gettingStartedConsole.php index ca0eacf..df5af20 100644 --- a/examples/cloud/gettingStartedConsole.php +++ b/examples/cloud/gettingStartedConsole.php @@ -43,7 +43,7 @@ // Only declare and call the main function if this is being run directly. // This prevents main from being run where examples are run as part of // PHPUnit tests. -if (basename(__FILE__) == basename($_SERVER["SCRIPT_FILENAME"])) +if (strtolower(basename(__FILE__)) == strtolower(basename($_SERVER["SCRIPT_FILENAME"]))) { function main($argv) { diff --git a/readme.md b/readme.md index 7d984a8..82b5888 100644 --- a/readme.md +++ b/readme.md @@ -22,13 +22,22 @@ to use the Cloud API. You can create resource keys using our ## Examples +**Note: Examples run on Linux and macOS. Windows environment is not explicitly supported as it is a rare choice for PHP.** + To run the examples, you will need PHP and composer installed. -Once these are available, install the dependencies required by the examples. +Once these are available, install (or update) the dependencies required by the examples. Navigate to the repository root and execute: -``` +```sh composer install ``` +or + +```sh +composer update +``` +if dependencies were install previously. + This will create the vendor directory containing autoload.php. @@ -37,13 +46,13 @@ Now navigate to the examples directory and start a PHP server with the relevant For example: ``` -php -S localhost:3000 cloud/gettingstarted.php +resource_key=YOUR_RESOURCE_KEY php -S localhost:3000 cloud/gettingStartedWeb.php ``` or to run in a terminal ``` -php cloud/gettingstarted.php +resource_key=YOUR_RESOURCE_KEY php cloud/gettingStartedConsole.php ``` This will start a local web server listening on port 3000. From fd1236b3564dda368ab7a5063a75382eccc41fd1 Mon Sep 17 00:00:00 2001 From: Eugene Dorfman Date: Thu, 16 May 2024 10:16:54 +0200 Subject: [PATCH 2/2] doc: slightly updated Windows message --- readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/readme.md b/readme.md index 82b5888..686a3fe 100644 --- a/readme.md +++ b/readme.md @@ -22,7 +22,7 @@ to use the Cloud API. You can create resource keys using our ## Examples -**Note: Examples run on Linux and macOS. Windows environment is not explicitly supported as it is a rare choice for PHP.** +**Note: Examples run on Linux and macOS. We don't test on Windows environments as it is a rare choice for PHP.** To run the examples, you will need PHP and composer installed. Once these are available, install (or update) the dependencies required by the examples.