Skip to content

Commit d2fe3e3

Browse files
committed
feat: initial PHP SDK scaffold with Saloon connector, codegen, and CI
0 parents  commit d2fe3e3

189 files changed

Lines changed: 77153 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: composer
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
open-pull-requests-limit: 5
8+
groups:
9+
dev-dependencies:
10+
dependency-type: development
11+
12+
- package-ecosystem: github-actions
13+
directory: /
14+
schedule:
15+
interval: weekly

.github/workflows/ci.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [main]
7+
8+
jobs:
9+
test:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
php: ['8.2', '8.3', '8.4']
14+
steps:
15+
- uses: actions/checkout@v6
16+
17+
- uses: shivammathur/setup-php@v2
18+
with:
19+
php-version: ${{ matrix.php }}
20+
coverage: none
21+
22+
- uses: actions/setup-node@v6
23+
with:
24+
node-version: '24'
25+
26+
- run: composer install --prefer-dist --no-interaction
27+
28+
- name: Codegen drift check
29+
if: matrix.php == '8.2'
30+
run: |
31+
node scripts/generate.mjs
32+
git diff --exit-code -- specs/openapi.json src/Generated tests/Generated src/Version.php \
33+
|| { echo 'codegen drift: commit the regenerated files'; exit 1; }
34+
35+
- name: Lint
36+
if: matrix.php == '8.2'
37+
run: vendor/bin/pint --test
38+
39+
- name: Static analysis
40+
if: matrix.php == '8.2'
41+
run: vendor/bin/phpstan analyse --no-progress --memory-limit=1G
42+
43+
- name: Test
44+
run: vendor/bin/pest --no-coverage
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Dependabot auto-merge
2+
3+
on: pull_request
4+
5+
permissions:
6+
contents: write
7+
pull-requests: write
8+
9+
jobs:
10+
auto-merge:
11+
if: github.actor == 'dependabot[bot]'
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Fetch Dependabot metadata
15+
id: meta
16+
uses: dependabot/fetch-metadata@v3
17+
- name: Auto-approve patch and minor bumps
18+
if: steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor'
19+
run: gh pr review --approve "$PR_URL"
20+
env:
21+
PR_URL: ${{ github.event.pull_request.html_url }}
22+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
- name: Enable auto-merge for patch and minor bumps
24+
if: steps.meta.outputs.update-type == 'version-update:semver-patch' || steps.meta.outputs.update-type == 'version-update:semver-minor'
25+
run: gh pr merge --auto --squash --delete-branch "$PR_URL"
26+
env:
27+
PR_URL: ${{ github.event.pull_request.html_url }}
28+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: Release
2+
3+
on:
4+
repository_dispatch:
5+
types: [openapi-updated]
6+
schedule:
7+
- cron: '0 6 * * *'
8+
workflow_dispatch:
9+
inputs:
10+
version_bump:
11+
description: 'patch | minor | major'
12+
required: false
13+
default: 'patch'
14+
15+
jobs:
16+
release:
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
steps:
21+
- uses: actions/checkout@v6
22+
with:
23+
token: ${{ secrets.GITHUB_TOKEN }}
24+
fetch-depth: 0
25+
26+
- uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: '8.2'
29+
tools: composer
30+
coverage: none
31+
32+
- uses: actions/setup-node@v6
33+
with:
34+
node-version: '24'
35+
36+
- run: composer install --prefer-dist --no-interaction
37+
38+
- name: Regenerate from live OpenAPI
39+
run: node scripts/generate.mjs
40+
41+
- name: Sync docs from spec
42+
run: node scripts/sync-docs.mjs
43+
44+
- name: Check if spec changed
45+
id: diff
46+
run: |
47+
OLD=$(git show HEAD:specs/openapi.json | jq -cS '{paths, components}')
48+
NEW=$(jq -cS '{paths, components}' specs/openapi.json)
49+
if [ "$OLD" = "$NEW" ]; then
50+
echo "changed=false" >> $GITHUB_OUTPUT
51+
else
52+
echo "changed=true" >> $GITHUB_OUTPUT
53+
fi
54+
55+
- name: Lint
56+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
57+
run: vendor/bin/pint --test
58+
59+
- name: Static analysis
60+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
61+
run: vendor/bin/phpstan analyse --no-progress --memory-limit=1G
62+
63+
- name: Test
64+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
65+
run: vendor/bin/pest --no-coverage
66+
67+
- name: Bump version
68+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
69+
id: bump
70+
run: |
71+
BUMP="${{ github.event.inputs.version_bump || 'patch' }}"
72+
npm version "$BUMP" --no-git-tag-version
73+
VERSION=$(node -p "require('./package.json').version")
74+
# Mirror version into composer.json so packagist sees it on tag.
75+
node -e "const fs=require('fs');const p=require('./composer.json');p.version='$VERSION';fs.writeFileSync('composer.json',JSON.stringify(p,null,4)+'\n');"
76+
# Regenerate Version.php from the new package.json version.
77+
node scripts/generate.mjs
78+
echo "version=$VERSION" >> $GITHUB_OUTPUT
79+
80+
- name: Commit, tag, push
81+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
82+
run: |
83+
git config user.name "github-actions[bot]"
84+
git config user.email "github-actions[bot]@users.noreply.github.com"
85+
VERSION="${{ steps.bump.outputs.version }}"
86+
git add composer.json package.json src/Version.php specs/openapi.json src/Generated tests/Generated README.md AGENTS.md
87+
git commit -m "release: v$VERSION"
88+
git tag "v$VERSION"
89+
git push --follow-tags
90+
91+
- name: Create GitHub release
92+
if: steps.diff.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
93+
uses: softprops/action-gh-release@v3
94+
with:
95+
tag_name: v${{ steps.bump.outputs.version }}
96+
generate_release_notes: true
97+
make_latest: 'true'
98+
99+
- name: No changes
100+
if: steps.diff.outputs.changed == 'false' && github.event_name != 'workflow_dispatch'
101+
run: echo "OpenAPI spec unchanged. Nothing to release."

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/vendor/
2+
/node_modules/
3+
/build/
4+
*.log
5+
.phpunit.cache/
6+
.phpunit.result.cache
7+
.phpstan-cache/
8+
phpstan.cache
9+
.DS_Store
10+
.idea/
11+
.vscode/
12+
.cursor/
13+
.claude/
14+
.env
15+
.env.*
16+
*.env.*
17+
18+
# Maintainer-only docs
19+
CLAUDE.md
20+
MAINTAINER.md
21+
MAINTAINER-*.md
22+
AUDIT.md
23+
AUDIT-*.md
24+
todo.md
25+
docs

0 commit comments

Comments
 (0)