Skip to content

Commit 05377e1

Browse files
authored
Api 3.0, PHP7.4 and PHP8 compatability (#44)
1 parent 0ad06b5 commit 05377e1

File tree

161 files changed

+14086
-2383
lines changed

Some content is hidden

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

161 files changed

+14086
-2383
lines changed

.github/dependabot.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1+
---
12
version: 2
23
updates:
3-
- package-ecosystem: composer
4-
directory: "/"
5-
schedule:
6-
interval: weekly
7-
time: "04:00"
8-
open-pull-requests-limit: 10
4+
- package-ecosystem: composer
5+
directory: "/"
6+
schedule:
7+
interval: daily
8+
time: "08:00"
9+
open-pull-requests-limit: 10

.github/workflows/main.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
name: Run tests
23

34
on:
@@ -9,9 +10,9 @@ jobs:
910
fail-fast: false
1011
matrix:
1112
php:
12-
- 7.2
13-
- 7.3
1413
- 7.4
14+
- 8.0
15+
- 8.1
1516
dependency-version:
1617
- prefer-lowest
1718
- prefer-stable
@@ -26,12 +27,11 @@ jobs:
2627
- name: Checkout code
2728
uses: actions/checkout@v1
2829
- name: Setup PHP
29-
uses: shivammathur/setup-php@v1
30+
uses: shivammathur/setup-php@v2
3031
with:
3132
php-version: ${{ matrix.php }}
3233
extensions: curl, json
33-
tools: prestissimo
34-
coverage: xdebug
34+
coverage: pcov
3535
- name: Composer self-update
3636
run: |
3737
composer self-update
@@ -40,4 +40,4 @@ jobs:
4040
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
4141
- name: Composer ${{ matrix.test }}-${{ matrix.os }}
4242
run: |
43-
composer ${{ matrix.test }}
43+
composer ${{ matrix.test }}

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
/vendor/
22
/.idea/
3-
composer.lock
43
clover.xml
4+
.phpunit.result.cache

.mergify.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
pull_request_rules:
2-
- name: automatic merge on new dependency
2+
- name: automatic merge on depenabot pull requests
33
conditions:
44
- author=dependabot[bot]
5-
- status-success=continuous-integration/travis-ci/pr
5+
- check-success=Run tests
66
actions:
77
merge:
88
method: merge

.phan/config.php

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

README.md

Lines changed: 49 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,49 @@
1-
# Hostfact API 2.7 for Laravel 5+
1+
# Hostfact API 3.0 for Laravel
22

3-
[![Build Status](https://travis-ci.org/hyperized/hostfact.svg?branch=master)](https://travis-ci.org/hyperized/hostfact)
43
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact?ref=badge_shield)
54

65
Official documentation:
76
-----------------------
87

9-
* [Hostfact API 2.7](https://www.hostfact.nl/hostfact-hosting/apiv2/)
10-
* [Official API examples](https://www.hostfact.nl/hostfact-hosting/apiv2/)
8+
* [Hostfact API documentation](https://www.hostfact.nl/developer/api/)
119

1210
Installation
1311
------------
1412

1513
Install using composer:
14+
1615
```bash
1716
composer require hyperized/hostfact
1817
```
1918

20-
This package supports Package Auto-Discovery (Laravel 5.5+) so it doesn't require you to manually add the ServiceProvider and alias.
19+
This package supports Package Auto-Discovery (Laravel 5.5+) so it doesn't require you to manually add the
20+
ServiceProvider and alias.
2121

22-
If you are using a lower version of Laravel or not using Auto-Discovery you can add the Hostfact Service Provider to the `config/app.php` file
22+
If you are using a lower version of Laravel or not using Auto-Discovery you can add the Hostfact Service Provider to
23+
the `config/app.php` file
2324

2425
```php
2526
Hyperized\Hostfact\HostfactServiceProvider::class,
2627
```
27-
Register a alias for Hostfact, also in `config/app.php`:
28+
29+
Register an alias for Hostfact, also in `config/app.php`:
2830

2931
```php
3032
'Hostfact' => Hyperized\Hostfact\HostfactServiceProvider::class,
3133
```
34+
3235
Now publish the Hostfact package into your installation:
36+
3337
```bash
3438
php artisan vendor:publish --provider="Hyperized\Hostfact\HostfactServiceProvider" --tag="config"
3539
```
36-
This should give you a message like: `Copied File [/vendor/hyperized/hostfact/src/config/Hostfact.php] To [/config/Hostfact.php]`
3740

38-
It's possible to edit your configuration variables in the `config/Hostfact.php` file or you can use the `HOSTFACT_URL` and `HOSTFACT_KEY` environment variables to store sensitive information in the `.env` file
41+
This should give you a message
42+
like: `Copied File [/vendor/hyperized/hostfact/config/Hostfact.php] To [/config/Hostfact.php]`
43+
44+
It's possible to edit your configuration variables in the `config/Hostfact.php` file or you can use the `HOSTFACT_URL`
45+
and `HOSTFACT_KEY` environment variables to store sensitive information in the `.env` file
46+
3947
```php
4048
// config/Hostfact.php
4149
'api_v2_url' => env('HOSTFACT_URL', 'https://yoursite.tld/Pro/apiv2/api.php'),
@@ -48,32 +56,40 @@ HOSTFACT_KEY=token
4856
HOSTFACT_TIMEOUT=20
4957
```
5058

51-
Example code:
52-
```php
53-
// Direct use
54-
$product = new Hyperized\Hostfact\Types\Product();
55-
$productParams = [
56-
'searchfor' => 'invoice'
57-
];
58-
$output = $product->list($productParams);
59-
60-
// Use in Controllers
61-
use Hyperized\Hostfact\Types\Product;
62-
63-
class MyController extends Controller {
64-
public function getProducts()
65-
{
66-
$product = new Product();
67-
$productParams = [
68-
'searchfor' => 'invoice'
69-
];
70-
return $product->list($productParams);
71-
}
72-
}
73-
```
59+
Functionality
60+
---------
61+
62+
When writing code for this Hostfact package, consider that this package has been written as a basic interface.
7463

64+
This package _will_ do the following:
7565

66+
* Provide an easy way to communicate with Hostfact API controllers;
67+
* Document the available API controller endpoints with methods;
68+
* Transport layer (HTTP/HTTPS) error catching;
69+
* Basic error parsing;
7670

71+
This package _will not_:
72+
73+
* Parameter / input validation;
74+
* Output validation;
75+
76+
You will need to consult the [Hostfact API documentation](https://www.hostfact.nl/developer/api/) to understand the
77+
acceptable input and output for each of the API controllers.
78+
79+
Examples
80+
--------
81+
82+
Example code:
83+
84+
```php
85+
use \Hyperized\Hostfact\Api\Controllers\Product;
86+
87+
$products = Product::new()
88+
->list([
89+
'searchfor' => 'invoice'
90+
]);
91+
```
7792

7893
## License
79-
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact?ref=badge_large)
94+
95+
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fhyperized%2Fhostfact?ref=badge_large)

composer.json

Lines changed: 38 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
22
"name": "hyperized/hostfact",
3-
"description": "Hostfact 2.7 API Implementation",
3+
"description": "Hostfact 3.0 API Implementation for Laravel",
44
"keywords": [
5+
"hyperized",
56
"hostfact",
6-
"hostfact-api"
7+
"api"
78
],
89
"type": "library",
910
"minimum-stability": "stable",
@@ -15,21 +16,19 @@
1516
}
1617
],
1718
"require": {
18-
"php": "^7.2.5",
19-
"illuminate/support": "^7.2|^8.0",
20-
"ext-curl": "*",
21-
"ext-json": "*"
19+
"php": "^7.4|^8.0|^8.1",
20+
"guzzlehttp/guzzle": "^7.4",
21+
"hyperized/value-objects": "^0.3.0"
2222
},
2323
"require-dev": {
24-
"phpunit/phpunit": "^8.0",
25-
"squizlabs/php_codesniffer": "^3.5",
26-
"povils/phpmnd": "^2.0",
27-
"bmitch/churn-php": "^1.0.3",
28-
"phan/phan": "^3.0 || ^5.0",
29-
"phpstan/phpstan": "^0.12.0 || ^1.0.0",
30-
"phpmd/phpmd": "^2.8",
31-
"infection/infection": "^0.15.0",
32-
"vimeo/psalm": "^3.8 || ^4.0"
24+
"phpunit/phpunit": "^9.5",
25+
"phpmd/phpmd": "^2.10",
26+
"vimeo/psalm": "^4.13",
27+
"orchestra/testbench": "^6.23",
28+
"phpstan/phpstan": "^1.2",
29+
"squizlabs/php_codesniffer": "^3.6",
30+
"povils/phpmnd": "^2.4",
31+
"infection/infection": "^0.25.3"
3332
},
3433
"autoload": {
3534
"psr-4": {
@@ -44,42 +43,41 @@
4443
"extra": {
4544
"laravel": {
4645
"providers": [
47-
"Hyperized\\Hostfact\\HostfactServiceProvider"
46+
"Hyperized\\Hostfact\\Providers\\HostfactServiceProvider"
4847
],
4948
"aliases": {
50-
"Hostfact": "Hyperized\\Hostfact\\HostfactServiceProvider"
49+
"Hostfact": "Hyperized\\Hostfact\\Providers\\HostfactServiceProvider"
5150
}
5251
}
5352
},
5453
"scripts": {
54+
"test": [
55+
"@phpmd",
56+
"@psalm",
57+
"@phpstan",
58+
"@phpcbf",
59+
"@phpcs",
60+
"@phpmnd",
61+
"@phpunit",
62+
"@infection"
63+
],
64+
"test-github": [
65+
"@test"
66+
],
5567
"phpunit": "vendor/phpunit/phpunit/phpunit --configuration phpunit.xml.dist",
56-
"phan": "vendor/bin/phan --allow-polyfill-parser",
5768
"phpmd": "vendor/bin/phpmd --strict src text cyclomatic.xml",
69+
"psalm": "vendor/bin/psalm",
70+
"phpstan": "vendor/bin/phpstan analyse",
5871
"phpcs": "vendor/bin/phpcs src --standard=PSR2 || true",
5972
"phpcbf": "vendor/bin/phpcbf src",
6073
"phpmnd": "vendor/bin/phpmnd src",
61-
"churn": "vendor/bin/churn run src",
62-
"phpstan": "vendor/bin/phpstan --level=7 analyse src tests",
63-
"infection": "vendor/bin/infection",
64-
"psalm": "vendor/bin/psalm",
65-
"test-github": [
66-
"@phpunit",
67-
"@phpmd",
68-
"@phpmnd",
69-
"@churn",
70-
"@infection"
74+
"infection": "vendor/bin/infection || true",
75+
"major": [
76+
"composer update",
77+
"@update-major",
78+
"@update-major-dev"
7179
],
72-
"test": [
73-
"@phpunit",
74-
"@phan",
75-
"@phpmd",
76-
"@phpcbf",
77-
"@phpcs",
78-
"@phpmnd",
79-
"@churn",
80-
"@phpstan",
81-
"@infection",
82-
"@psalm"
83-
]
80+
"update-major": "jq -r '.require | keys[]' composer.json | xargs composer require --update-with-all-dependencies",
81+
"update-major-dev": "jq -r '.\"require-dev\" | keys[]' composer.json | xargs composer require --dev --update-with-all-dependencies"
8482
}
8583
}

0 commit comments

Comments
 (0)