Skip to content

Commit 5f506e4

Browse files
committed
Initial commit
0 parents  commit 5f506e4

28 files changed

+10985
-0
lines changed

.github/workflows/ci.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
test:
11+
name: Test on PHP ${{ matrix.php-version }} with Laravel ${{ matrix.laravel-version }}
12+
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
php-version: [8.2, 8.3]
19+
laravel-version: [11.*, 12.*]
20+
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Setup PHP
26+
uses: shivammathur/setup-php@v2
27+
with:
28+
php-version: ${{ matrix.php-version }}
29+
extensions: mbstring, xml, ctype, iconv, intl, pdo_sqlite
30+
coverage: none
31+
32+
- name: Install dependencies
33+
run: composer install --prefer-dist --no-interaction
34+
35+
- name: Check code formatting
36+
run: composer format-test
37+
38+
- name: Run tests
39+
run: composer test
40+
41+
- name: Upload test results
42+
uses: actions/upload-artifact@v4
43+
if: always()
44+
with:
45+
name: test-results-php-${{ matrix.php-version }}-laravel-${{ matrix.laravel-version }}
46+
path: |
47+
.phpunit.result.cache
48+
.phpunit.result.xml

.github/workflows/code-quality.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Code Quality
2+
3+
on:
4+
push:
5+
branches: [main, develop]
6+
pull_request:
7+
branches: [main, develop]
8+
9+
jobs:
10+
code-quality:
11+
name: Code Quality Checks
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 8.3
23+
extensions: mbstring, xml, ctype, iconv, intl
24+
25+
- name: Install dependencies
26+
run: composer install --prefer-dist --no-interaction
27+
28+
- name: Check code formatting with Pint
29+
run: composer format-test
30+
31+
- name: Check for syntax errors
32+
run: php -l src/
33+
continue-on-error: false
34+
35+
- name: Check for syntax errors in tests
36+
run: php -l tests/
37+
continue-on-error: false
38+
39+
- name: Validate composer.json
40+
run: composer validate --strict
41+
42+
- name: Check for security vulnerabilities
43+
run: composer audit --format=json --output=composer-audit.json
44+
continue-on-error: true
45+
46+
- name: Upload security audit results
47+
uses: actions/upload-artifact@v4
48+
if: always()
49+
with:
50+
name: security-audit
51+
path: composer-audit.json

.github/workflows/dependencies.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Dependencies
2+
3+
on:
4+
schedule:
5+
# Run every Monday at 9 AM UTC
6+
- cron: "0 9 * * 1"
7+
workflow_dispatch: # Allow manual triggering
8+
9+
jobs:
10+
dependencies:
11+
name: Check Dependencies
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout code
17+
uses: actions/checkout@v4
18+
19+
- name: Setup PHP
20+
uses: shivammathur/setup-php@v2
21+
with:
22+
php-version: 8.3
23+
extensions: mbstring, xml, ctype, iconv, intl
24+
25+
- name: Install dependencies
26+
run: composer install --prefer-dist --no-interaction
27+
28+
- name: Check for outdated packages
29+
run: composer outdated --direct --format=json --output=composer-outdated.json
30+
continue-on-error: true
31+
32+
- name: Check for security vulnerabilities
33+
run: composer audit --format=json --output=composer-audit.json
34+
continue-on-error: true
35+
36+
- name: Upload dependency check results
37+
uses: actions/upload-artifact@v4
38+
if: always()
39+
with:
40+
name: dependency-checks
41+
path: |
42+
composer-outdated.json
43+
composer-audit.json
44+
45+
- name: Create issue for security vulnerabilities
46+
if: failure()
47+
uses: actions/github-script@v7
48+
with:
49+
script: |
50+
const fs = require('fs');
51+
let auditData = {};
52+
53+
try {
54+
const auditContent = fs.readFileSync('composer-audit.json', 'utf8');
55+
auditData = JSON.parse(auditContent);
56+
} catch (error) {
57+
console.log('No audit data found');
58+
}
59+
60+
if (auditData.advisories && Object.keys(auditData.advisories).length > 0) {
61+
const issueTitle = '🚨 Security vulnerabilities detected in dependencies';
62+
const issueBody = `## Security Alert
63+
64+
Security vulnerabilities were detected in the package dependencies.
65+
66+
### Vulnerabilities Found:
67+
${Object.values(auditData.advisories).map(adv =>
68+
`- **${adv.packageName}** (${adv.affectedVersions}): ${adv.title}`
69+
).join('\n')}
70+
71+
### Recommended Actions:
72+
1. Review the vulnerabilities above
73+
2. Update affected packages to secure versions
74+
3. Test thoroughly after updates
75+
4. Consider using \`composer audit --fix\` if available
76+
77+
---
78+
*This issue was automatically created by GitHub Actions*`;
79+
80+
await github.rest.issues.create({
81+
owner: context.repo.owner,
82+
repo: context.repo.repo,
83+
title: issueTitle,
84+
body: issueBody,
85+
labels: ['security', 'dependencies', 'automated']
86+
});
87+
}

.gitignore

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Composer Related
2+
composer.lock
3+
/vendor
4+
5+
# Frontend Assets
6+
/node_modules
7+
8+
# Logs
9+
npm-debug.log
10+
yarn-error.log
11+
12+
# Caches
13+
.phpunit.cache
14+
.phpunit.result.cache
15+
/build
16+
17+
# IDE Helper
18+
_ide_helper.php
19+
_ide_helper_models.php
20+
.phpstorm.meta.php
21+
22+
# Editors
23+
/.idea
24+
/.fleet
25+
/.vscode
26+
27+
# Misc
28+
phpunit.xml
29+
phpstan.neon
30+
testbench.yaml
31+
/docs
32+
/coverage

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) Nathan Dunn <[email protected]>
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
13+
all 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
21+
THE SOFTWARE.

0 commit comments

Comments
 (0)