diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index b13df1d..ad0715b 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -24,7 +24,7 @@ jobs: - "8.4" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: "Install PHP" uses: "shivammathur/setup-php@v2" @@ -40,7 +40,7 @@ jobs: run: composer install --prefer-dist --no-progress - name: PHPUnit - run: ./vendor/bin/phpunit tests + run: ./vendor/bin/phpunit - name: PHP-CS-Fixer run: ./vendor/bin/php-cs-fixer fix --dry-run --diff @@ -48,4 +48,4 @@ jobs: PHP_CS_FIXER_IGNORE_ENV: 1 - name: PHPStan - run: ./vendor/bin/phpstan analyze src --no-progress + run: ./vendor/bin/phpstan analyze --no-progress diff --git a/.gitignore b/.gitignore index 6846b7c..93604a2 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ vendor composer.lock README.md.* +/.idea/ +/.serena/ diff --git a/CLAUDE.md b/CLAUDE.md new file mode 100644 index 0000000..df41e2d --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1,25 @@ +# Private Packagist API Client + +PHP API client for Private Packagist. + +## Commands + +- `composer test` — Run tests +- `composer cs-fix` — Fix code style (src + tests) +- `composer analyze` — Run PHPStan static analysis + +## Architecture + +- `src/Api/AbstractApi.php` — Base class for all API endpoints. Provides `get()` for single resources and `getCollection()` for list endpoints with auto-pagination. +- `src/Api/*.php` — API endpoint classes (Packages, Teams, Customers, etc.) +- `src/Api/*/` — Nested API endpoints (e.g. `Customers/VendorBundles`, `Packages/Artifacts`) +- `src/Client.php` — Entry point, provides access to all API classes + +## Notes + +- Supports PHP 7.2+ — avoid modern syntax not available in 7.2 + +## Conventions + +- List endpoints use `getCollection()` (handles pagination and default limit) +- Single-resource endpoints use `get()` \ No newline at end of file diff --git a/composer.json b/composer.json index 69253f1..c2ee976 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,9 @@ "psr-4": { "PrivatePackagist\\ApiClient\\": "tests/"} }, "scripts": { + "analyze": "phpstan analyze --no-progress", + "cs-fix": "php-cs-fixer fix", + "test": "phpunit", "toc": "./gh-md-toc --insert README.md" }, "config": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist new file mode 100644 index 0000000..f86d23c --- /dev/null +++ b/phpunit.xml.dist @@ -0,0 +1,18 @@ + + + + + tests + + + + + + src + + +