Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update example to work with PHP 8 #11

Merged
merged 2 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion .github/workflows/php_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
php: [7.3, 7.4, 8.0, 8.1, 8.2]
php: [7.4, 8.0, 8.1, 8.2]

steps:
- name: Checkout
Expand All @@ -34,3 +34,15 @@ jobs:

- name: PHP tests
run: ./vendor/bin/phpunit --process-isolation tests

- name: Composer install example
working-directory: example
run: composer install

- name: Inject dummy example config
working-directory: example
run: printf "[duo]\nclient_id=DIAAAAAAAAAAAAAAAAAA\nclient_secret=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\napi_hostname=example.duosecurity.com\nredirect_uri=http://localhost:8080\nfailmode=closed\n" > ./duo.conf

- name: Ensure example runs
working-directory: example
run: php index.php
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ What's included:
* `tests` - Test cases

## Getting started
This library requires PHP 7.3 or later
This library requires PHP 7.4 or later

To use SDK in your existing developing environment, install it from Packagist
```
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
}
},
"require": {
"php": ">=7.3",
"php": ">=7.4",
"ext-curl": "*",
"ext-json": "*",
"firebase/php-jwt": "^6.0"
Expand Down
8 changes: 4 additions & 4 deletions example/composer.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"require": {
"slim/slim": "4.7.1",
"slim/psr7": "1.3.0",
"slim/php-view": "3.0.0",
"bryanjhv/slim-session": "4.0",
"slim/slim": "4.12.0",
"slim/psr7": "1.6.1",
"slim/php-view": "3.2.0",
"bryanjhv/slim-session": "4.1.2",
"duosecurity/duo_universal_php": "@dev"
},
"repositories": [
Expand Down
6 changes: 4 additions & 2 deletions example/dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM php:7
FROM php:8
EXPOSE 8080
RUN apt update && apt install -y unzip wget
WORKDIR /root
RUN wget https://raw.githubusercontent.com/composer/getcomposer.org/885ece8a6e1370b204b89b7a542169d25aa21177/web/installer -O - -q | php -- --quiet
ADD . /src

ADD ./composer.json /src/composer.json
WORKDIR /src
RUN /root/composer.phar update
ADD . /src
ENTRYPOINT ["php", "-S", "0.0.0.0:8080"]
2 changes: 1 addition & 1 deletion example/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$config['api_hostname'],
$config['redirect_uri'],
true,
$config['http_proxy'],
$config['http_proxy'] ?? null,
jeffreyparker marked this conversation as resolved.
Show resolved Hide resolved
);
} catch (DuoException $e) {
throw new ErrorException("*** Duo config error. Verify the values in duo.conf are correct ***\n" . $e->getMessage());
Expand Down