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

v4 #8

Draft
wants to merge 38 commits into
base: master
Choose a base branch
from
Draft

v4 #8

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
c042581
Update friendsofphp/php-cs-fixer
PATROMO Dec 15, 2021
e1ec7f9
Improve php-cs-fixer call
PATROMO Dec 15, 2021
2714d64
Update guzzlehttp/guzzle 7.3.0 to 7.4.1
PATROMO Dec 15, 2021
bb66c08
Update examples and ause api key from env
PATROMO Dec 15, 2021
0e66a34
Update examples and ause api key from env
PATROMO Dec 15, 2021
d53c4da
Use nette/php-generator to generate models from swagger file
PATROMO Dec 15, 2021
275ec66
Add generators dir to cs fix
PATROMO Dec 15, 2021
1d0f5d7
move commands from makefile to composer scripts
PATROMO Dec 15, 2021
bb2e6be
Add first models
PATROMO Dec 15, 2021
ed7fc64
Remove useless Makefile file
PATROMO Dec 15, 2021
d2acd3d
Improve scripts definition in composer.json
PATROMO Dec 16, 2021
5a26fe7
Update models, add tests and more...
PATROMO Dec 21, 2021
7648064
change cs fixer settings and drop extends in models
PATROMO Dec 21, 2021
b0e2595
Add github actions
PATROMO Dec 21, 2021
cf63542
update composer description
PATROMO Dec 21, 2021
06553ea
fix github workflow
PATROMO Dec 21, 2021
33a43da
fix github workflow
PATROMO Dec 21, 2021
c7b8c1f
drop php7.4 from github workflow
PATROMO Dec 21, 2021
f285c58
support DateTime
PATROMO Dec 21, 2021
91c518d
Add enum to comment and DocumentPosition support in document
PATROMO Dec 21, 2021
8a487c8
fix naming
PATROMO Dec 21, 2021
47ce1e9
php cs fix
PATROMO Dec 21, 2021
ac2d227
Add versions to generated files
PATROMO Dec 21, 2021
38968c8
Update composer scripts descriptions
PATROMO Dec 21, 2021
ad6eeac
Add date time support
PATROMO Dec 22, 2021
724e08f
Add support for array with object items
PATROMO Dec 22, 2021
daa4fce
Improve phpdoc
PATROMO Dec 22, 2021
d5483f2
update readme
PATROMO Dec 22, 2021
f640f96
code cleanup and add some type hints
PATROMO Dec 22, 2021
1b7ac02
Add UPGRADE.md
PATROMO Dec 22, 2021
72adc53
Rename namespace
PATROMO Dec 22, 2021
4a62db0
add declare(strict_types=1) to all php files
PATROMO Dec 22, 2021
533acc2
Update models from url.
PATROMO Jan 19, 2022
0ee0338
Update example
PATROMO Jan 19, 2022
4b96882
Update example
PATROMO Jan 19, 2022
c78c52e
Update dependencies
PATROMO Jan 19, 2022
98e85da
Merge branch 'master' into pr/v4
PATROMO Mar 30, 2022
831dcfb
update composer dependencies...
PATROMO Mar 30, 2022
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
35 changes: 35 additions & 0 deletions .github/workflows/php-cs-fixer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: php-cs-fixer

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- { operating-system: 'ubuntu-latest', php-version: '8.1', dependencies: '--ignore-platform-req=php' }

name: PHP ${{ matrix.php-version }}

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: composer:v2

- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-progress ${{ matrix.dependencies }}
- name: Check code style
run: |
php vendor/bin/php-cs-fixer --using-cache=no --diff --dry-run --stop-on-violation --verbose fix
36 changes: 36 additions & 0 deletions .github/workflows/phpunit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: PHPUnit

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
include:
- { operating-system: 'ubuntu-latest', php-version: '8.0', dependencies: '--ignore-platform-req=php' }
- { operating-system: 'ubuntu-latest', php-version: '8.1', dependencies: '--ignore-platform-req=php' }

name: PHP ${{ matrix.php-version }}

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
tools: composer:v2

- name: Install dependencies
run: |
composer install --no-interaction --prefer-dist --no-progress ${{ matrix.dependencies }}
- name: Run tests
run: |
php vendor/bin/phpunit tests
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.idea
vendor
.php_cs.cache
.php-cs-fixer.cache
19 changes: 19 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

return (new PhpCsFixer\Config())
->setRiskyAllowed(false)
->setRules([
'@PSR2' => true,
'@Symfony' => true,
'@PhpCsFixer' => true,
'@DoctrineAnnotation' => true,
'concat_space' => ['spacing' => 'one'],

])
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__ . '/src')
->in(__DIR__ . '/examples')
->in(__DIR__ . '/generators')
->in(__DIR__ . '/tests')
);
35 changes: 0 additions & 35 deletions .php_cs.dist

This file was deleted.

9 changes: 0 additions & 9 deletions Makefile

This file was deleted.

23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,32 @@ composer require easybill/php-sdk
## Usage

```php
use easybill\SDK\Client;
use easybill\SDK\Endpoint;
use Easybill\SDK\Client;
use Easybill\SDK\Endpoint;
use Easybill\SDK\Models\Customer;

$client = new Client(new Endpoint('... your API key ...'));

$result = $client->request('GET', 'documents');
$customerCreate = new Customer();
$customerCreate->setFirstName('Foo');
$customerCreate->setLastName('Bar');
$customerCreate->setCompanyName('FooBar GmbH');
$customerCreate->setEmails(['[email protected]']);

print_r($result);
$result = $client->request('POST', 'customers', $customerCreate->toArray());

$customer = new Customer($result);

var_dump($customer)
```

## More examples

Check the **examples** folder.
Check the [examples](examples) folder and run:

```shell
API_KEY=<your_api_key> php examples/customers_01_load-list.php
```

## Documentation

Expand Down
8 changes: 8 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
easybill PHP SDK Upgrade Guide
==============================

3.0 to 4.0
----------

- Namespace from `easybill\` to `Easybill\`
- Requires min PHP 8.0
30 changes: 25 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "easybill/php-sdk",
"description": "easybill PHP SDK (API)",
"description": "easybill PHP SDK (REST API)",
"keywords": [
"PHP",
"easybill",
Expand All @@ -19,16 +19,36 @@
}
],
"require": {
"php": "^7.4 || ^8.0",
"php": "^8.0 || ^8.1",
"ext-json": "*",
"guzzlehttp/guzzle": "^7.3"
"guzzlehttp/guzzle": "^7.4"
},
"autoload": {
"psr-4": {
"easybill\\SDK\\": "src/"
"Easybill\\SDK\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"Easybill\\SDK\\Tests\\": "tests/"
}
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.17"
"friendsofphp/php-cs-fixer": "^3.4",
"nette/php-generator": "^3.6",
"phpunit/phpunit": "^9.5"
},
"scripts": {
"sdk:models": [
"@php generators/models.php",
"@sdk:cs-fix"
],
"sdk:cs-fix": "./vendor/bin/php-cs-fixer fix",
"sdk:test": "./vendor/bin/phpunit tests"
},
"scripts-descriptions": {
"sdk:models": "Gnerate models from swagger.json file.",
"sdk:cs-fix": "Run php-cs-fixer to reformat php files.",
"sdk:test": "Run test with PHPUnit"
}
}
Loading