Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 3 additions & 3 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- "8.4"

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
Expand All @@ -40,12 +40,12 @@ jobs:
run: composer install --prefer-dist --no-progress

- name: PHPUnit
run: ./vendor/bin/phpunit tests
run: ./vendor/bin/phpunit
Comment thread
pscheit marked this conversation as resolved.

- name: PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff
env:
PHP_CS_FIXER_IGNORE_ENV: 1

- name: PHPStan
run: ./vendor/bin/phpstan analyze src --no-progress
run: ./vendor/bin/phpstan analyze --no-progress
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ vendor
composer.lock

README.md.*
/.idea/
/.serena/
25 changes: 25 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -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()`
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 18 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
bootstrap="vendor/autoload.php"
colors="true"
>
<testsuites>
<testsuite name="default">
<directory>tests</directory>
</testsuite>
</testsuites>

<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
</coverage>
</phpunit>