|
| 1 | +# atomic-php/package-scaffold |
| 2 | + |
| 3 | +Quickly scaffold a PHP package that follows the Atomic style (as used by `atomic-php/http-kernel` and `atomic-php/router`). |
| 4 | + |
| 5 | +- Structure: `src/`, `tests/`, `benchmarks/`, `.github/workflows/ci.yml` |
| 6 | +- QA: `.editorconfig`, `.php-cs-fixer.php`, `psalm.xml`, `phpunit.xml.dist` |
| 7 | +- Docs: `README.md`, `LICENSE` (MIT), `CONTRIBUTING.md`, `SECURITY.md`, `CHANGELOG.md` |
| 8 | +- Composer scripts: `test`, `test-coverage`, `psalm`, `cs-check`, `cs-fix`, `benchmark`, `qa` |
| 9 | +- Optional PSR requirements: PSR-7, PSR-15, PSR-11 |
| 10 | + |
| 11 | +## Requirements |
| 12 | +- bash |
| 13 | +- git + GitHub CLI (`gh auth login`) |
| 14 | +- PHP 8.4+, Composer (for the generated package) |
| 15 | + |
| 16 | +## Usage |
| 17 | + |
| 18 | +```bash |
| 19 | +# Basic |
| 20 | +scripts/scaffold-php-package.sh http-foundation "PSR-7 utilities and factories" --with-psr7 |
| 21 | + |
| 22 | +# With PSR-15 and Container |
| 23 | +scripts/scaffold-php-package.sh events "Lightweight event dispatcher" --with-psr15 --with-container |
| 24 | + |
| 25 | +# Customize vendor, org, keywords |
| 26 | +scripts/scaffold-php-package.sh cache "Simple cache library" \ |
| 27 | + --vendor atomic --org atomic-php --keywords "php cache performance library" |
| 28 | +``` |
| 29 | + |
| 30 | +Options: |
| 31 | +- `--org` (default: `atomic-php`): GitHub organization used in README badges |
| 32 | +- `--vendor` (default: `atomic`): Composer vendor name |
| 33 | +- `--name-slug`: override the Composer package name (defaults to directory name) |
| 34 | +- `--keywords`: space‑separated keywords for composer.json |
| 35 | +- `--with-psr7`: add `psr/http-message` |
| 36 | +- `--with-psr15`: add `psr/http-server-handler` and `psr/http-server-middleware` |
| 37 | +- `--with-container`: add `psr/container` |
| 38 | + |
| 39 | +## What it generates |
| 40 | +- Composer metadata aligned with Atomic repos |
| 41 | +- CI workflow mirroring the Atomic style (tests, coverage, psalm, cs, validate) |
| 42 | +- Standard code quality and docs files |
| 43 | + |
| 44 | +## After scaffolding |
| 45 | +```bash |
| 46 | +cd <dir> |
| 47 | +composer install |
| 48 | +git init && git add . && git commit -m "chore: initial scaffold" |
| 49 | +# Create GitHub repo and push |
| 50 | +gh repo create atomic-php/<dir> --public --source=. --remote=origin --push |
| 51 | +``` |
| 52 | + |
| 53 | +## License |
| 54 | +MIT |
| 55 | + |
0 commit comments