diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml deleted file mode 100644 index 83b7546..0000000 --- a/.github/FUNDING.yml +++ /dev/null @@ -1,2 +0,0 @@ -# These are supported funding model platforms -github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [StanBarrows] diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 7546b77..bc5e177 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,18 +1,18 @@ name: Bug Report description: Report an Issue or Bug with the Package title: "[Bug]: " -labels: ["bug"] +labels: [ "bug" ] body: - type: markdown attributes: - value: | - We're sorry to hear you have a problem. Can you help us solve it by providing the following details. + value: "| +We're sorry to hear you have a problem. Can you help us solve it by providing the following details." - type: textarea id: what-happened attributes: label: What happened? description: What did you expect to happen? - placeholder: I cannot currently do X thing because when I do, it breaks X thing. + placeholder: "I cannot currently do X thing because when I do, it breaks X thing." validations: required: true - type: input @@ -20,7 +20,8 @@ body: attributes: label: Package Version description: What version of our Package are you running? Please be as specific as possible - placeholder: 1.0.0 + placeholder: "12.0" + value: "12.0" validations: required: true - type: input @@ -28,7 +29,8 @@ body: attributes: label: PHP Version description: What version of PHP are you running? Please be as specific as possible - placeholder: 8.3.0 + placeholder: "8.4.0" + value: "8.4.0" validations: required: true - type: input @@ -36,7 +38,8 @@ body: attributes: label: Laravel Version description: What version of Laravel are you running? Please be as specific as possible - placeholder: 11.0.0 + placeholder: "12.0.0" + value: "12.0.0" validations: required: true - type: dropdown diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..0bc378d --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + labels: + - "dependencies" diff --git a/.github/workflows/dependabot-auto-merge.yml b/.github/workflows/dependabot-auto-merge.yml index 14da349..2df1631 100644 --- a/.github/workflows/dependabot-auto-merge.yml +++ b/.github/workflows/dependabot-auto-merge.yml @@ -10,20 +10,20 @@ jobs: runs-on: ubuntu-latest if: ${{ github.actor == 'dependabot[bot]' }} steps: - + - name: Dependabot metadata id: metadata - uses: dependabot/fetch-metadata@v1.3.3 + uses: dependabot/fetch-metadata@v2.3.0 with: github-token: "${{ secrets.GITHUB_TOKEN }}" - + - name: Auto-merge Dependabot PRs for semver-minor updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-minor'}} run: gh pr merge --auto --merge "$PR_URL" env: PR_URL: ${{github.event.pull_request.html_url}} GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - + - name: Auto-merge Dependabot PRs for semver-patch updates if: ${{steps.metadata.outputs.update-type == 'version-update:semver-patch'}} run: gh pr merge --auto --merge "$PR_URL" diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml new file mode 100644 index 0000000..0d4a013 --- /dev/null +++ b/.github/workflows/dependency-review.yml @@ -0,0 +1,20 @@ +# Dependency Review Action +# +# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. +# +# Source repository: https://github.com/actions/dependency-review-action +# Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement +name: 'Dependency Review' +on: [pull_request] + +permissions: + contents: read + +jobs: + dependency-review: + runs-on: ubuntu-latest + steps: + - name: 'Checkout Repository' + uses: actions/checkout@v4 + - name: 'Dependency Review' + uses: actions/dependency-review-action@v4 diff --git a/.github/workflows/fix-php-code-style-issues.yml b/.github/workflows/fix-php-code-style-issues.yml new file mode 100644 index 0000000..ef2fadf --- /dev/null +++ b/.github/workflows/fix-php-code-style-issues.yml @@ -0,0 +1,21 @@ +name: Fix PHP code style issues + +on: [push] + +jobs: + php-code-styling: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Fix PHP code style issues + uses: aglipanci/laravel-pint-action@2.5 + + - name: Commit changes + uses: stefanzweifel/git-auto-commit-action@v5 + with: + commit_message: Fix styling diff --git a/.github/workflows/php-cs-fixer.yml b/.github/workflows/php-cs-fixer.yml deleted file mode 100644 index 3517cf1..0000000 --- a/.github/workflows/php-cs-fixer.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Check & fix styling - -on: - push: - branches: - - styling - -jobs: - php-cs-fixer: - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v3 - with: - ref: ${{ github.head_ref }} - - - name: Run PHP CS Fixer - uses: docker://oskarstark/php-cs-fixer-ga - with: - args: --config=.php-cs-fixer.dist.php --allow-risky=yes - - - name: Commit changes - uses: stefanzweifel/git-auto-commit-action@v4 - with: - commit_message: Fix styling diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 090fd83..b0cde6a 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -2,25 +2,25 @@ name: PHPStan on: push: - branches: [ main ] - pull_request: - branches: [ main ] + paths: + - '**.php' + - 'phpstan.neon.dist' jobs: phpstan: name: phpstan runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 with: - php-version: '8.2' + php-version: '8.4' coverage: none - name: Install composer dependencies - uses: ramsey/composer-install@v2 + uses: ramsey/composer-install@v3 - name: Run PHPStan - run: ./vendor/bin/phpstan analyse src --error-format=github + run: ./vendor/bin/phpstan --error-format=github diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..afa28ff --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,23 @@ +name: release + +on: + pull_request: + types: + - closed + branches: + - main +jobs: + release: + name: Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: '0' + - name: Bump version and push tag + uses: anothrNick/github-tag-action@master + env: + GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} + WITH_V: true + RELEASE_BRANCHES: main + DEFAULT_BUMP: minor diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 682b498..54f1f3d 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -11,17 +11,18 @@ jobs: runs-on: ${{ matrix.os }} strategy: fail-fast: true + max-parallel: 1 matrix: - os: [ ubuntu-latest, windows-latest ] - php: [ 8.2, 8.3 ] - laravel: [ 11.* ] + os: [ ubuntu-latest ] + php: [ 8.2, 8.3, 8.4 ] + laravel: [ 12.* ] stability: [ prefer-lowest, prefer-stable ] name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup PHP uses: shivammathur/setup-php@v2 @@ -40,7 +41,7 @@ jobs: composer require "laravel/framework:${{ matrix.laravel }}" --no-interaction --no-update composer update --${{ matrix.stability }} --prefer-dist --no-interaction - - name: Set phpunit.xml + - name: Execute tests run: cp phpunit.xml.dist phpunit.xml - name: Execute tests @@ -48,10 +49,9 @@ jobs: env: FLATFOX_TOKEN: ${{ secrets.FLATFOX_TOKEN }} - - name: Store test reports - uses: actions/upload-artifact@v2 + - name: Store Log Artifacts + if: failure() + uses: actions/upload-artifact@v4 with: - name: Store report - retention-days: 1 - path: | - ./reports + name: Store report artifacts + path: ./vendor/orchestra/testbench-core/laravel/storage/logs diff --git a/.gitignore b/.gitignore index adac56e..91b23b2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,12 @@ .idea -.php_cs -.php_cs.cache -.php-cs-fixer.cache .phpunit.result.cache -.DS_STORE -build +.phpunit.cache composer.lock coverage -docs phpunit.xml -psalm.xml +phpstan.neon testbench.yaml vendor node_modules -phpstan.neon +.phpactor.json +build diff --git a/README.md b/README.md index 21ecb32..3a1d460 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ [![Latest Version on Packagist](https://img.shields.io/packagist/v/codebar-ag/laravel-flatfox.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/laravel-flatfox) +[![GitHub-Tests](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/run-tests.yml) +[![GitHub Code Style](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/fix-php-code-style-issues.yml/badge.svg?branch=main)](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/fix-php-code-style-issues.yml) [![Total Downloads](https://img.shields.io/packagist/dt/codebar-ag/laravel-flatfox.svg?style=flat-square)](https://packagist.org/packages/codebar-ag/laravel-flatfox) -[![run-tests](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/run-tests.yml/badge.svg)](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/run-tests.yml) -[![PHPStan](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/phpstan.yml/badge.svg)](https://github.com/codebar-ag/laravel-flatfox/actions/workflows/phpstan.yml) This package was developed to give you a quick start to receive public listings from the Flatfox API. @@ -13,9 +13,11 @@ Flatfox is a web-based portal where you can Search & advertise apartments for fr ## 🛠 Requirements -| Package | PHP | Laravel | Flatfox | -|-----------|-------|----------------|-----------| -| >v1.0 | >8.2 | > Laravel 10.0 | ✅ | +| Package | PHP | Laravel | Flatfox | +|-----------|-------------|-----------|-----------| +| v12.0.0 | ^8.2 - ^8.4 | 12.x | ✅ | +| v11.0.0 | ^8.2 | 11.x | ✅ | +| v1.0.0 | ^8.2 | 10.x | ✅ | ## ⚙️ Installation diff --git a/composer.json b/composer.json index 5fea96f..344c5b5 100644 --- a/composer.json +++ b/composer.json @@ -11,33 +11,34 @@ "license": "MIT", "authors": [ { - "name": "Sebastian Fix", - "email": "sebastian.fix@codebar.ch", + "name": "Sebastian Bürgin-Fix", + "email": "sebastian.buergin@buergin.ch", "homepage": "https://www.codebar.ch", - "role": "Developer" + "role": "Sofware-Engineer" + }, + { + "name": "Rhys Lees", + "role": "Software-Engineer" } ], "require": { - "php": ">=8.2", + "php": "8.2.*|8.3.*|8.4.*", "guzzlehttp/guzzle": "^7.8", - "illuminate/contracts": "^11.0", - "saloonphp/laravel-plugin": "^3.2", - "saloonphp/saloon": "^3.4", + "illuminate/contracts": "^12.0", "saloonphp/cache-plugin": "^3.0", - "spatie/laravel-package-tools": "^1.16" + "saloonphp/laravel-plugin": "^3.5", + "saloonphp/saloon": "^3.10.1", + "spatie/laravel-package-tools": "^1.19" }, "require-dev": { - "laravel/pint": "^1.13", - "nunomaduro/collision": "^8.1", - "larastan/larastan": "^2.8", - "pestphp/pest": "^2.31", - "orchestra/testbench": "^9.0", - "pestphp/pest-plugin-laravel": "^2.2", - "pestphp/pest-plugin-arch": "^2.6", - "phpstan/extension-installer": "^1.3", - "phpstan/phpstan-deprecation-rules": "^1.1", - "phpstan/phpstan-phpunit": "^1.3", - "spatie/laravel-ray": "^1.33" + "laravel/pint": "^1.21", + "larastan/larastan": "^v3.1", + "orchestra/testbench": "^10.0", + "pestphp/pest": "^3.7", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan-deprecation-rules": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "spatie/laravel-ray": "^1.39" }, "autoload": { "psr-4": { diff --git a/phpstan.neon.dist b/phpstan.neon.dist index e005ac7..0cc2d04 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -2,12 +2,11 @@ includes: - phpstan-baseline.neon parameters: - level: 4 + level: 5 paths: - src - config tmpDir: build/phpstan checkOctaneCompatibility: true checkModelProperties: true - checkMissingIterableValueType: false - + noEnvCallsOutsideOfConfig: false diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 34ddb80..d1f11f7 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -20,6 +20,12 @@ + - \ No newline at end of file + + + ./src + + + diff --git a/src/DTO/Agency.php b/src/DTO/Agency.php index 58c694b..388b773 100644 --- a/src/DTO/Agency.php +++ b/src/DTO/Agency.php @@ -15,8 +15,7 @@ public function __construct( public ?string $country, public ?string $logo_url, public ?string $logo_url_org_logo_m, - ) { - } + ) {} public static function fromJson(array $data): self { diff --git a/src/DTO/Attribute.php b/src/DTO/Attribute.php index 838ca08..7ca4993 100644 --- a/src/DTO/Attribute.php +++ b/src/DTO/Attribute.php @@ -8,8 +8,7 @@ class Attribute { public function __construct( public ?string $name, - ) { - } + ) {} public static function fromJson(array $data): self { diff --git a/src/DTO/Document.php b/src/DTO/Document.php index 5c62fca..376a5ca 100644 --- a/src/DTO/Document.php +++ b/src/DTO/Document.php @@ -11,8 +11,7 @@ public function __construct( public ?string $url, public ?int $ordering, public ?string $caption, - ) { - } + ) {} public static function fromJson(array $data): self { diff --git a/src/DTO/Image.php b/src/DTO/Image.php index c9f729e..5881706 100644 --- a/src/DTO/Image.php +++ b/src/DTO/Image.php @@ -16,8 +16,7 @@ public function __construct( public ?int $ordering, public ?int $width, public ?int $height, - ) { - } + ) {} public static function fromJson(array $data): self { diff --git a/src/DTO/Listing.php b/src/DTO/Listing.php index 8810939..6f9e171 100644 --- a/src/DTO/Listing.php +++ b/src/DTO/Listing.php @@ -70,8 +70,7 @@ public function __construct( public ?int $livingspace, public ?Carbon $published, public ?Carbon $created, - ) { - } + ) {} public static function fromJson(array $data): self { diff --git a/src/Flatfox.php b/src/Flatfox.php index 3484f90..17f505b 100644 --- a/src/Flatfox.php +++ b/src/Flatfox.php @@ -6,7 +6,7 @@ class Flatfox { - public function getPublicListing(string $identifier, string $expand): GetPublicListing + public function getPublicListing(string $identifier, array $expand): GetPublicListing { return new GetPublicListing($identifier, $expand); } diff --git a/src/Requests/GetPublicListing.php b/src/Requests/GetPublicListing.php index 899924f..6f91c25 100644 --- a/src/Requests/GetPublicListing.php +++ b/src/Requests/GetPublicListing.php @@ -34,8 +34,7 @@ public function resolveEndpoint(): string public function __construct( protected string $identifier, protected array $expand = [], - ) { - } + ) {} protected function defaultHeaders(): array { diff --git a/src/Response/PublicListing.php b/src/Response/PublicListing.php index 8b2d7dc..a03605f 100644 --- a/src/Response/PublicListing.php +++ b/src/Response/PublicListing.php @@ -14,8 +14,7 @@ public function __construct( public ?string $next, public ?string $previous, public ?Collection $results, - ) { - } + ) {} public static function fromResponse(Response $response): self {