Skip to content

Commit d7ab597

Browse files
authored
Merge pull request #9 from portier/feat-upgrade
Upgrade dependencies (BC), use GitHub Actions
2 parents 96e7650 + db8fac7 commit d7ab597

File tree

12 files changed

+174
-149
lines changed

12 files changed

+174
-149
lines changed

.github/workflows/check.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
11+
check:
12+
name: Check
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
php-versions: ['7.4', '8.0']
17+
steps:
18+
19+
- name: Checkout
20+
uses: actions/checkout@v2
21+
22+
- name: Setup PHP
23+
uses: shivammathur/setup-php@v2
24+
with:
25+
php-version: ${{ matrix.php-versions }}
26+
extensions: redis
27+
tools: cs2pr
28+
29+
- name: Get Composer cache directory
30+
id: composer-cache
31+
run: |
32+
echo "::set-output name=dir::$(composer config cache-files-dir)"
33+
34+
- name: Composer cache
35+
uses: actions/cache@v2
36+
with:
37+
path: ${{ steps.composer-cache.outputs.dir }}
38+
key: ${{ runner.os }}-composer
39+
40+
- name: Composer install
41+
run: composer install
42+
43+
- name: PHP CodeSniffer
44+
run: vendor/bin/phpcs --standard=PSR2 --report=checkstyle src/ | cs2pr
45+
46+
- name: PHPStan
47+
run: vendor/bin/phpstan analyse -l max -c phpstan.neon --error-format=checkstyle src/ | cs2pr
48+
49+
- name: Configure PHPUnit matchers
50+
uses: mheap/phpunit-matcher-action@v1
51+
52+
- name: PHPUnit
53+
run: vendor/bin/phpunit --teamcity

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
vendor
22
composer.lock
3+
.phpunit*

.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (C) 2016 Angry Bytes
1+
Copyright (C) 2021 Angry Bytes
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy of
44
this software and associated documentation files (the "Software"), to deal in

README.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# portier-php
22

3-
A [Portier] client library for PHP
3+
A [Portier] client library for PHP.
44

5-
[Portier]: https://portier.github.io/
5+
[portier]: https://portier.github.io/
66

77
### Example
88

@@ -11,7 +11,9 @@ A [Portier] client library for PHP
1111

1212
require 'vendor/autoload.php';
1313

14-
$app = new \Slim\App();
14+
$app = \Slim\Factory\AppFactory::create();
15+
$app->addRoutingMiddleware();
16+
$app->addErrorMiddleware(true, true, true);
1517

1618
$redis = new Redis();
1719
$redis->pconnect('127.0.0.1', 6379);
@@ -40,15 +42,15 @@ EOF
4042
});
4143

4244
$app->post('/auth', function($req, $res) use ($portier) {
43-
$authUrl = $portier->authenticate($req->getParsedBodyParam('email'));
45+
$authUrl = $portier->authenticate($req->getParsedBody()['email']);
4446

4547
return $res
4648
->withStatus(303)
4749
->withHeader('Location', $authUrl);
4850
});
4951

5052
$app->post('/verify', function($req, $res) use ($portier) {
51-
$email = $portier->verify($req->getParsedBodyParam('id_token'));
53+
$email = $portier->verify($req->getParsedBody()['id_token']);
5254

5355
$res = $res
5456
->withStatus(200)

composer.json

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
{
2-
"name": "portier/client",
3-
"description": "Portier client for PHP",
4-
"type": "library",
5-
"license": "MIT",
6-
"authors": [
7-
{
8-
"name": "Stéphan Kochen",
9-
"email": "stephan@kochen.nl"
10-
}
11-
],
12-
"autoload": {
13-
"psr-4": {
14-
"Portier\\Client\\": "src/"
15-
}
16-
},
17-
"require": {
18-
"spomky-labs/base64url": "^1.0",
19-
"fgrosse/phpasn1": "^2.0",
20-
"lcobucci/jwt": "^3.2",
21-
"guzzlehttp/guzzle": "^6.2"
22-
},
23-
"require-dev": {
24-
"phpunit/phpunit": "^7.5",
25-
"phpstan/phpstan": "^0.11",
26-
"squizlabs/php_codesniffer": "^3.1"
2+
"name": "portier/client",
3+
"description": "Portier client for PHP",
4+
"type": "library",
5+
"license": "MIT",
6+
"authors": [
7+
{
8+
"name": "Stéphan Kochen",
9+
"email": "stephan@kochen.nl"
2710
}
11+
],
12+
"autoload": {
13+
"psr-4": {
14+
"Portier\\Client\\": "src/"
15+
}
16+
},
17+
"require": {
18+
"fgrosse/phpasn1": "2.2",
19+
"lcobucci/clock": "^2.0",
20+
"lcobucci/jwt": "^4.1",
21+
"guzzlehttp/guzzle": "^7.3"
22+
},
23+
"require-dev": {
24+
"phpunit/phpunit": "^9.5",
25+
"phpstan/phpstan": "^0.12",
26+
"squizlabs/php_codesniffer": "^3.6",
27+
"phpspec/prophecy-phpunit": "^2.0"
28+
}
2829
}

phpstan.neon

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
parameters:
2-
ignoreErrors:
3-
# Invalid type hint
4-
- '|^Parameter #1 \$value of class FG\\ASN1\\Universal\\Integer constructor expects int, string given\.$|'
2+
ignoreErrors:
3+
-
4+
message: "#^Parameter \\#1 \\$value of class FG\\\\ASN1\\\\Universal\\\\Integer constructor expects int, string given\\.$#"
5+
count: 2
6+
path: src/Client.php
7+
8+
-
9+
message: "#^Cannot call method del\\(\\) on string\\|false\\.$#"
10+
count: 1
11+
path: src/RedisStore.php
12+

src/AbstractStore.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public function generateNonce(string $email): string
5252
* @param string $url The URL to fetch.
5353
* @return \stdClass An object with `ttl` and `data` properties.
5454
*/
55-
public function fetch(string $url)
55+
public function fetch(string $url): \stdClass
5656
{
5757
$res = $this->guzzle->get($url);
5858

0 commit comments

Comments
 (0)