← ClaudeAtlas

composer-package-hygienelisted

Composer-published package author concerns — semver decisions, public API surface declaration (@api / @internal / final), composer.json autoloader hygiene (PSR-4 vs files, allow-plugins, suggest vs require), Laravel package discovery validation (extra.laravel.providers/aliases), and the release flow (changelog ↔ tag ↔ gh release consistency). Framework-agnostic — applies to any PHP package distributed via Packagist, whether plain library, Symfony bundle, or Laravel package. Use when designing a public API for a new package, reviewing a composer.json before publishing, cutting a release, deciding whether a change is a major/minor/patch bump, auditing autoload entries, or validating that Laravel package discovery still works. Not for everyday application code — load only when working on a library that other projects will install. Counterpart to php-modern-pro (language-level idioms) and any future laravel-N-dev (framework patterns).
hmj1026/dhpk · ★ 1 · Data & Documents · score 72
Install: claude install-skill hmj1026/dhpk
# Composer package hygiene — author-side discipline This skill applies whenever you are working on a PHP package that gets published to Packagist (or a private composer repository) and installed into other projects. Application code does not need this. > Mental model: every line in `composer.json`, every public class, every > tag is a **contract** with downstream consumers. Breaking the contract > requires a major bump. Hide implementation aggressively so you keep the > contract small. --- ## Semver — what counts as breaking | Change | Bump | |---|---| | Remove or rename a public class / method / function | major | | Add a required parameter to a public method | major | | Tighten a public parameter type (e.g. `string` → `int`) | major | | Loosen a public return type (e.g. `string` → `string\|null`) | major | | Raise PHP floor (`^7.4 \|\| ^8.0` → `^8.0`) | major | | Raise a runtime dependency's floor in a way that excludes existing supporters | major | | Add a new public class / method | minor | | Add an optional parameter with a default | minor | | Tighten a return type (e.g. `string\|null` → `string`) | minor | | Loosen a parameter type (e.g. `int` → `int\|string`) | minor | | Add a new optional dependency to `suggest` | minor | | Bug fix that doesn't change documented behaviour | patch | | Documentation, internal refactor, test-only change | patch | **Trap**: "we never documented this method as public — we can remove it". If the method has a `public` visibility modifi