Skip to content

Commit b1f8c32

Browse files
committed
feat: initial scaffold script and CI
0 parents  commit b1f8c32

5 files changed

Lines changed: 433 additions & 0 deletions

File tree

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.sh]
10+
indent_style = space
11+
indent_size = 2

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- 'development'
8+
- 'feature/*'
9+
- 'bugfix/*'
10+
- 'hotfix/*'
11+
- 'releases/*'
12+
- 'v*.*.*'
13+
pull_request:
14+
branches:
15+
- main
16+
- 'development'
17+
- 'feature/*'
18+
- 'bugfix/*'
19+
- 'hotfix/*'
20+
- 'releases/*'
21+
- 'v*.*.*'
22+
23+
jobs:
24+
lint:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Ensure script is syntactically valid
29+
run: bash -n scripts/scaffold-php-package.sh
30+
- name: Print usage
31+
run: bash scripts/scaffold-php-package.sh || true

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
MIT License
2+
3+
Copyright (c) 2025 Thavarshan
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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

Comments
 (0)