diff --git a/.github/workflows/php_ci.yml b/.github/workflows/php_ci.yml index cba50cb..43cf6c1 100644 --- a/.github/workflows/php_ci.yml +++ b/.github/workflows/php_ci.yml @@ -14,7 +14,7 @@ jobs: strategy: matrix: - php: [7.4, 8.0, 8.1, 8.2, 8.3, 8.4, 8.5] + php: [8.2, 8.3, 8.4, 8.5] steps: - name: Checkout diff --git a/README.md b/README.md index 6223505..40c7c0b 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ What's included: * `tests` - Test cases ## Getting started -This library requires PHP 7.4 or later +This library requires PHP 8.2 or later To use SDK in your existing developing environment, install it from Packagist ``` diff --git a/example/composer.json b/example/composer.json index 9c3ddb1..253ee76 100644 --- a/example/composer.json +++ b/example/composer.json @@ -1,7 +1,7 @@ { "require": { "slim/slim": "4.12.0", - "slim/psr7": "1.6.1", + "slim/psr7": "^1.7", "slim/php-view": "3.2.0", "bryanjhv/slim-session": "4.1.2", "duosecurity/duo_universal_php": "@dev" diff --git a/example/index.php b/example/index.php index fcd0e36..3bad4d5 100644 --- a/example/index.php +++ b/example/index.php @@ -1,5 +1,7 @@ add(new Session()); $app->get('/', function (Request $request, Response $response, $args) { + # Helpfully redirect to `localhost` if accessed via 127.0.0.1 or 0.0.0.0 to ensure session cookie consistency and avoid state errors. + # (The url used in redirect_uri must match the url used to access the app) + if (in_array($request->getUri()->getHost(), ['127.0.0.1', '0.0.0.0'])) { + header('Location: http://localhost:' . $request->getUri()->getPort()); + exit(); + } + $renderer = new PhpRenderer('./templates'); $args["message"] = "This is a demo"; return $renderer->render($response, "login.php", $args);