Skip to content

Commit b42a44d

Browse files
PHP 8 min, json object decoding (#2)
* upgraded minimum php version to 8.0 * Changed json decode to objects instead of associative arrays * corrected build step * upgrade guide
1 parent 147fd53 commit b42a44d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+1071
-546
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
runs-on: ubuntu-latest
1111
strategy:
1212
matrix:
13-
php: [7.4, 8.0]
14-
arangodb: [3.6.0, 3.6, latest]
13+
php: [8.0]
14+
arangodb: [3.6, 3.7, latest]
1515
name: Quality checks PHP ${{ matrix.php }} / ArangoDB ${{ matrix.arangodb }}
1616

1717
services:
@@ -51,4 +51,4 @@ jobs:
5151
chmod +x "${GITHUB_WORKSPACE}/bin/qa.sh"
5252
"${GITHUB_WORKSPACE}/bin/qa.sh"
5353
env:
54-
ARANGODB_VERSION: ${{ matrix.arangodb }}
54+
ARANGODB_VERSION: ${{ matrix.arangodb }}

.github/workflows/coverage.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,13 @@ jobs:
2222
steps:
2323
- name: Checkout
2424
uses: actions/checkout@v2
25+
with:
26+
fetch-depth: 0
2527

2628
- name: Setup PHP
2729
uses: shivammathur/setup-php@v2
2830
with:
29-
fetch-depth: 2
30-
php-version: 7.4
31+
php-version: 8.0
3132
extensions: mbstring, intl
3233
ini-values: post_max_size=256M, short_open_tag=On
3334
coverage: xdebug
@@ -38,5 +39,5 @@ jobs:
3839
- name: Test coverage
3940
run: |
4041
vendor/bin/phpunit --coverage-clover clover.xml --whitelist src
41-
wget https://scrutinizer-ci.com/ocular.phar
42-
php ocular.phar code-coverage:upload --format=php-clover clover.xml
42+
echo "Upload results to Scrutinizer-ci"
43+
vendor/bin/ocular code-coverage:upload --format=php-clover clover.xml

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ArangoClient - ArangoDB PHP client
22

3-
Low level PHP client for ArangoDB. Supports PHP versions 7.4 & ^8.0
3+
Low level PHP client for ArangoDB. Supports PHP ^8.0.
44

55
![Github CI tests](https://github.com/LaravelFreelancerNL/arangodb-php-client/workflows/CI%20tests/badge.svg)
66
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/LaravelFreelancerNL/arangodb-php-client/badges/quality-score.png?b=next)](https://scrutinizer-ci.com/g/LaravelFreelancerNL/arangodb-php-client/?branch=next)
@@ -9,8 +9,10 @@ Low level PHP client for ArangoDB. Supports PHP versions 7.4 & ^8.0
99
<a href="https://packagist.org/packages/laravel-freelancer-nl/arangodb-php-client"><img src="https://poser.pugx.org/laravel-freelancer-nl/arangodb-php-client/downloads" alt="Total Downloads"></a>
1010
<a href="https://packagist.org/packages/laravel-freelancer-nl/arangodb-php-client"><img src="https://poser.pugx.org/laravel-freelancer-nl/arangodb-php-client/license" alt="License"></a>
1111

12-
## Install
12+
This client is a conduit to ArangoDB and back, so it doesn't make any presumptions on the returned data itself.
13+
JSON objects are decoded to POPO's. You can cast those to what you need in your ODM or project.
1314

15+
## Install
1416
```
1517
composer require laravel-freelancer-nl/arangodb-php-client
1618
```

UPGRADE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Upgrade Guide
2+
3+
## Upgrading From 1.x To 2.x
4+
5+
### Response objects instead of associative arrays
6+
The biggest change is the decoding of responses. JSON objects are now decoded to POPO's (Plain Old Php Objects).
7+
This will influence how you use the response. Together with the improvements in php 8 this makes the result data much
8+
nicer to work with compared to associative arrays.
9+
10+
This client is just a conduit, so it doesn't make any presumptions on the returned data itself, hence the the objects
11+
are of the stdClass type.
12+
13+
### PHP 8
14+
PHP 8.0 is now the minimum supported version. You will need to run your app with this version
15+
and ensure that other packages support it.
16+
17+
If you need to use PHP 7.4 you can use the maintenance branch 1.x
18+
19+
### Schema function result data
20+
Some schema functions just returned a boolean to indicate success or failure. These now match
21+
the returned result by ArangoDB.

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,21 @@
1616
"minimum-stability": "dev",
1717
"prefer-stable" : true,
1818
"require": {
19-
"php": "^7.4|^8.0",
19+
"php": "^8.0",
20+
"ext-curl": "*",
2021
"ext-json": "*",
21-
"guzzlehttp/guzzle": "^7.2",
22+
"guzzlehttp/guzzle": "^7.3",
2223
"halaxa/json-machine": "^0.6.0",
23-
"spatie/data-transfer-object": "^2.8"
24+
"spatie/data-transfer-object": "^3.1"
2425
},
2526
"require-dev": {
2627
"phpunit/phpunit": "^9.5",
2728
"phpstan/phpstan": "^0.12.82",
2829
"phpmd/phpmd": "^2.9",
29-
"vimeo/psalm": "^4.6",
30-
"squizlabs/php_codesniffer": "^3.5",
30+
"vimeo/psalm": "^4.7",
31+
"squizlabs/php_codesniffer": "^3.6",
3132
"mockery/mockery": "^1.4",
32-
"ext-curl": "*"
33+
"scrutinizer/ocular": "^1.8"
3334
},
3435
"autoload": {
3536
"psr-4": {

0 commit comments

Comments
 (0)