Skip to content

Commit

Permalink
Merged Pull Request '#56 fix/examples-issues->main : doc: improve exa…
Browse files Browse the repository at this point in the history
…mples guidance'

doc: improve examples guidance
  • Loading branch information
Automation51D authored May 16, 2024
2 parents d9edc97 + fd1236b commit 4104dda
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion examples/cloud/gettingStartedConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
17 changes: 13 additions & 4 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ to use the Cloud API. You can create resource keys using our

## Examples

**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 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.

Expand All @@ -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.
Expand Down

0 comments on commit 4104dda

Please sign in to comment.