Skip to content

Commit faf4eae

Browse files
committed
- Global refactoring
- Add enums classes - Add branding banners - Documentation improve
1 parent a42bc9b commit faf4eae

Some content is hidden

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

54 files changed

+840
-578
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
blank_issues_enabled: false
22
contact_links:
3-
- name: Ask a question
4-
url: https://github.com/datomatic/laravel-fatture-in-cloud/discussions/new?category=q-a
5-
about: Ask the community for help
6-
- name: Request a feature
7-
url: https://github.com/datomatic/laravel-fatture-in-cloud/discussions/new?category=ideas
8-
about: Share ideas for new features
9-
- name: Report a bug
10-
url: https://github.com/datomatic/laravel-fatture-in-cloud/issues/new
11-
about: Report a reproducable bug
3+
- name: Ask a question
4+
url: https://github.com/Datomatic/laravel-carta-del-docente/discussions/new?category=q-a
5+
about: Ask the community for help
6+
- name: Request a feature
7+
url: https://github.com/Datomatic/laravel-carta-del-docente/discussions/new?category=ideas
8+
about: Share ideas for new features
9+
- name: Report a security issue
10+
url: https://github.com/Datomatic/laravel-carta-del-docente/security/policy
11+
about: Learn how to notify us for sensitive bugs
12+
- name: Report a bug
13+
url: https://github.com/Datomatic/laravel-carta-del-docente/issues/new
14+
about: Report a reproducible bug
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: dependabot-auto-merge
2+
on: pull_request_target
3+
4+
permissions:
5+
pull-requests: write
6+
contents: write
7+
8+
jobs:
9+
dependabot:
10+
runs-on: ubuntu-latest
11+
if: ${{ github.actor == 'dependabot[bot]' }}
12+
steps:
13+
14+
- name: Dependabot metadata
15+
id: metadata
16+
uses: dependabot/[email protected]
17+
with:
18+
github-token: "${{ secrets.GITHUB_TOKEN }}"
19+
20+
- name: Auto-merge Dependabot PRs for semver-minor updates
21+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}}
22+
run: gh pr merge --auto --merge "$PR_URL"
23+
env:
24+
PR_URL: ${{github.event.pull_request.html_url}}
25+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
26+
27+
- name: Auto-merge Dependabot PRs for semver-patch updates
28+
if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}}
29+
run: gh pr merge --auto --merge "$PR_URL"
30+
env:
31+
PR_URL: ${{github.event.pull_request.html_url}}
32+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

.github/workflows/php-cs-fixer.yml renamed to .github/workflows/fix-php-code-style-issues.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
1-
name: Check & fix styling
1+
name: Fix PHP code style issues
22

3-
on: [push]
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
47

58
jobs:
6-
php-cs-fixer:
9+
php-code-styling:
710
runs-on: ubuntu-latest
811

912
steps:
1013
- name: Checkout code
11-
uses: actions/checkout@v2
14+
uses: actions/checkout@v3
1215
with:
1316
ref: ${{ github.head_ref }}
1417

15-
- name: Run PHP CS Fixer
16-
uses: docker://oskarstark/php-cs-fixer-ga
17-
with:
18-
args: --config=.php_cs.dist.php --allow-risky=yes
18+
- name: Fix PHP code style issues
19+
uses: aglipanci/[email protected]
1920

2021
- name: Commit changes
2122
uses: stefanzweifel/git-auto-commit-action@v4

.github/workflows/phpstan.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PHPStan
2+
3+
on:
4+
push:
5+
paths:
6+
- '**.php'
7+
- 'phpstan.neon.dist'
8+
9+
jobs:
10+
phpstan:
11+
name: phpstan
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Setup PHP
17+
uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: '8.1'
20+
coverage: none
21+
22+
- name: Install composer dependencies
23+
uses: ramsey/composer-install@v1
24+
25+
- name: Run PHPStan
26+
run: ./vendor/bin/phpstan --error-format=github

.github/workflows/psalm.yml

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

.github/workflows/run-tests.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest, windows-latest]
16-
php: [8.0,8.1]
17-
laravel: [8.*,9.*]
16+
php: [8.2, 8.1]
17+
laravel: [9.*]
1818
stability: [prefer-lowest, prefer-stable]
1919
include:
20-
- laravel: ^8.*|^9.*
21-
testbench: ^6.6|^7.3
20+
- laravel: 9.*
21+
testbench: 7.*
2222

2323
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2424

2525
steps:
2626
- name: Checkout code
27-
uses: actions/checkout@v2
27+
uses: actions/checkout@v3
2828

2929
- name: Setup PHP
3030
uses: shivammathur/setup-php@v2
@@ -43,5 +43,8 @@ jobs:
4343
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
4444
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
4545
46+
- name: List Installed Dependencies
47+
run: composer show -D
48+
4649
- name: Execute tests
47-
run: vendor/bin/phpunit
50+
run: vendor/bin/pest
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: "Update Changelog"
2+
3+
on:
4+
release:
5+
types: [released]
6+
7+
jobs:
8+
update:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v3
14+
with:
15+
ref: main
16+
17+
- name: Update Changelog
18+
uses: stefanzweifel/changelog-updater-action@v1
19+
with:
20+
latest-version: ${{ github.event.release.name }}
21+
release-notes: ${{ github.event.release.body }}
22+
23+
- name: Commit updated CHANGELOG
24+
uses: stefanzweifel/git-auto-commit-action@v4
25+
with:
26+
branch: main
27+
commit_message: Update CHANGELOG
28+
file_pattern: CHANGELOG.md

README.md

Lines changed: 45 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
1+
![Laravel-Fatture-in-Cloud-Dark](branding/dark.png#gh-dark-mode-only)![Laravel-Fatture-in-Cloud-Light](branding/light.png#gh-light-mode-only)
12
# Laravel wrapper for Fatture in Cloud API v2
23

3-
[![Latest Version on Packagist](https://img.shields.io/packagist/v/datomatic/laravel-fatture-in-cloud.svg?style=flat-square)](https://packagist.org/packages/datomatic/laravel-fatture-in-cloud)
4-
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/datomatic/laravel-fatture-in-cloud/run-tests?label=tests)](https://github.com/datomatic/laravel-fatture-in-cloud/actions?query=workflow%3Arun-tests+branch%3Amain)
5-
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/datomatic/laravel-fatture-in-cloud/Check%20&%20fix%20styling?label=code%20style)](https://github.com/datomatic/laravel-fatture-in-cloud/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
6-
[![Total Downloads](https://img.shields.io/packagist/dt/datomatic/laravel-fatture-in-cloud.svg?style=flat-square)](https://packagist.org/packages/datomatic/laravel-fatture-in-cloud)
4+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/datomatic/laravel-fatture-in-cloud.svg?style=for-the-badge)](https://packagist.org/packages/datomatic/laravel-fatture-in-cloud)
5+
[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/datomatic/laravel-fatture-in-cloud/run-tests?style=for-the-badge&label=tests)](https://github.com/datomatic/laravel-fatture-in-cloud/actions?query=workflow%3Arun-tests+branch%3Amain)
6+
[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/datomatic/laravel-fatture-in-cloud/Fix%20PHP%20code%20style%20issues?style=for-the-badge&label=code%20style)](https://github.com/datomatic/laravel-fatture-in-cloud/actions?query=workflow%3A"Check+%26+fix+styling"+branch%3Amain)
7+
[![Total Downloads](https://img.shields.io/packagist/dt/datomatic/laravel-fatture-in-cloud.svg?style=for-the-badge)](https://packagist.org/packages/datomatic/laravel-fatture-in-cloud)
78

89
---
910
This Laravel wrapper allows you to integrate [Fatture in Cloud](https://fattureincloud.it) using Api v2.
10-
<img src="https://s3.eu-west-1.amazonaws.com/fattureincloud-landing/img/loghi/logo-fic-blu.png" alt="Fatture in Cloud"/>
1111

12+
## Requirements
13+
14+
- Laravel >= 8.37
15+
- PHP >= 8.1
16+
- ext-json
1217

1318
## Installation
1419

@@ -18,7 +23,7 @@ You can install the package via composer:
1823
composer require datomatic/laravel-fatture-in-cloud
1924
```
2025

21-
You can publish the config file with:
26+
Optionally, you can publish the config file with:
2227
```bash
2328
php artisan vendor:publish --provider="Datomatic\FattureInCloud\FattureInCloudServiceProvider" --tag="laravel-fatture-in-cloud-config"
2429
```
@@ -35,13 +40,22 @@ return [
3540

3641
## Usage
3742

38-
Get FattureInCloud class from service container.
43+
Get FattureInCloud class from service container or using `FattureInCloud` Facade.
44+
45+
```php
46+
use Datomatic\FattureInCloud\Facades\FattureInCloud;
47+
//Facade
48+
FattureInCloud::invoice()->...
49+
50+
use Datomatic\FattureInCloud\FattureInCloud;
3951

40-
Example on controller
41-
`public function __construct(FattureInCloud $fic)`
52+
//Automatic Injection
53+
public function __construct(FattureInCloud $fic){}
4254

43-
Example with app helper
44-
`$fic = app(Datomatic\FattureInCloud\FattureInCloud::class)`
55+
//Resolve
56+
$fic = App::make(CartaDelDocenteClient::class);
57+
$fic = app(Datomatic\FattureInCloud\FattureInCloud::class);
58+
```
4559

4660
Use the Fatture In CLoud utilities classes
4761

@@ -70,6 +84,19 @@ This is the utilities covered:
7084
- paymentAccounts()
7185
- paymentMethods()
7286

87+
### Enums
88+
89+
To improve the use of api usage is included a comfortable list of utilities enums:
90+
- DocumentStatus
91+
- EntityType
92+
- IssuedDocumentType
93+
- ReceivedDocumentType
94+
- PaymentStatus
95+
96+
### Utilities
97+
98+
The Fatture in CLoud API accept only a fullname on country field 🤦‍♂️ so i add a `Datomatic\FattureInCloud\Utilities\CountryConverter` utility class with `fromAlpha2` and `fromName` methods.
99+
73100
## Testing
74101

75102
```bash
@@ -82,11 +109,16 @@ Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed re
82109

83110
## Contributing
84111

85-
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
112+
Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
113+
114+
## Security Vulnerabilities
115+
116+
Please review [our security policy](../../security/policy) on how to report security vulnerabilities.
86117

87118
## Credits
88119

89-
- [Alberto](https://github.com/Tr1pp0)
120+
- [Alberto Peripolli](https://github.com/trippo)
121+
- [All Contributors](../../contributors)
90122

91123
## License
92124

composer.json

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,23 @@
1717
}
1818
],
1919
"require": {
20-
"php": "^8.0",
20+
"php": "^8.1",
21+
"datomatic/laravel-enum-helper": "^1.0",
2122
"ext-json": "*",
22-
"spatie/laravel-package-tools": "^1.4.3",
23+
"spatie/laravel-package-tools": "^1.13.0",
2324
"illuminate/contracts": "^8.37||^9.0"
2425
},
2526
"require-dev": {
26-
"brianium/paratest": "^6.2",
27-
"nunomaduro/collision": "^5.3",
28-
"orchestra/testbench": "^6.15",
29-
"phpunit/phpunit": "^9.3",
30-
"spatie/laravel-ray": "^1.23",
31-
"vimeo/psalm": "^4.8"
27+
"laravel/pint": "^1.0",
28+
"nunomaduro/collision": "^6.0",
29+
"nunomaduro/larastan": "^2.0.1",
30+
"orchestra/testbench": "^7.0",
31+
"pestphp/pest": "^1.21",
32+
"pestphp/pest-plugin-laravel": "^1.1",
33+
"phpstan/extension-installer": "^1.1",
34+
"phpstan/phpstan-deprecation-rules": "^1.0",
35+
"phpstan/phpstan-phpunit": "^1.0",
36+
"phpunit/phpunit": "^9.5"
3237
},
3338
"autoload": {
3439
"psr-4": {
@@ -41,18 +46,27 @@
4146
}
4247
},
4348
"scripts": {
44-
"psalm": "vendor/bin/psalm",
45-
"test": "./vendor/bin/testbench package:test --parallel --no-coverage",
46-
"test-coverage": "vendor/bin/phpunit --coverage-html coverage"
49+
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
50+
"analyse": "vendor/bin/phpstan analyse",
51+
"test": "vendor/bin/pest",
52+
"test-coverage": "vendor/bin/pest --coverage",
53+
"format": "vendor/bin/pint"
4754
},
4855
"config": {
49-
"sort-packages": true
56+
"sort-packages": true,
57+
"allow-plugins": {
58+
"pestphp/pest-plugin": true,
59+
"phpstan/extension-installer": true
60+
}
5061
},
5162
"extra": {
5263
"laravel": {
5364
"providers": [
5465
"Datomatic\\FattureInCloud\\FattureInCloudServiceProvider"
55-
]
66+
],
67+
"aliases": {
68+
"CartaDelDocente": "Datomatic\\FattureInCloud\\Facades\\FattureInCloud"
69+
}
5670
}
5771
},
5872
"minimum-stability": "dev",

config/fatture-in-cloud.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
2+
23
// config for Datomatic/FattureInCloud
34
return [
4-
'access_token' => env('FATTURE_IN_CLOUD_ACCESS_TOKEN'),
5-
'company_id' => env('FATTURE_IN_CLOUD_COMPANY_ID'),
6-
'endpoint' => env('FATTURE_IN_CLOUD_ENDPOINT','https://api-v2.fattureincloud.it/'),
5+
'access_token' => env('FATTURE_IN_CLOUD_ACCESS_TOKEN'),
6+
'company_id' => env('FATTURE_IN_CLOUD_COMPANY_ID'),
7+
'endpoint' => env('FATTURE_IN_CLOUD_ENDPOINT', 'https://api-v2.fattureincloud.it/'),
78
];

0 commit comments

Comments
 (0)