Skip to content

Commit 364558f

Browse files
committed
up
1 parent f70ec89 commit 364558f

22 files changed

Lines changed: 254 additions & 1 deletion

.github/workflows/ci.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,23 @@ on:
99
jobs:
1010
build-test:
1111
runs-on: ubuntu-latest
12+
services:
13+
mysql:
14+
image: mysql:8.0
15+
env:
16+
MYSQL_ALLOW_EMPTY_PASSWORD: "yes"
17+
MYSQL_DATABASE: test
18+
MYSQL_ROOT_PASSWORD: ""
19+
ports:
20+
- 3306:3306
21+
options: >-
22+
--health-cmd="mysqladmin ping -h 127.0.0.1 --silent"
23+
--health-interval=10s
24+
--health-timeout=5s
25+
--health-retries=30
1226
strategy:
1327
matrix:
14-
php: [ '8.0', '8.1', '8.2', '8.3' ]
28+
php: [ '8.2', '8.3' ]
1529

1630
steps:
1731
- name: Checkout
@@ -30,6 +44,17 @@ jobs:
3044
- name: Install dependencies
3145
run: composer install --no-interaction --no-progress --prefer-dist
3246

47+
- name: Install MySQL client
48+
run: sudo apt-get update && sudo apt-get install -y mysql-client
49+
50+
- name: Wait for MySQL
51+
run: |
52+
for i in {1..60}; do
53+
mysqladmin ping -h 127.0.0.1 --silent && break
54+
sleep 2
55+
done
56+
mysql -h 127.0.0.1 -uroot -e "SHOW DATABASES;"
57+
3358
- name: Generate autoload
3459
run: composer dump-autoload -o
3560

CHANGELOG.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
11
# Changelog
22

3+
## 2.0.1 - Type Safety & CI Hardening (2025-11-12)
4+
5+
### ✅ What changed
6+
- Static analysis: Reduced PHPStan issues to zero with precise generics, array-shape docs, and guards across core modules.
7+
- App hardening: Cleaned up Router, RBAC, Cache, Authenticator, ApiController, Monitor, and middlewares for stricter typing and better error handling.
8+
- Tests cleanup: Modernized tests to remove always-true assertions, add return types, guard glob/file reads, and align with updated return shapes.
9+
- CI ready: Ensured the test suite runs green on clean environments.
10+
11+
### 🔧 Highlights
12+
- RBAC: Normalized user roles mapping and removed unused state.
13+
- ApiController: Simplified cache-key logic and removed redundant checks; consistent return tuples.
14+
- Monitor & RequestLogger: Safer I/O guards; added minimal reads to satisfy analyzer without behavior change.
15+
- Cache: Tightened typing in manager and drivers; safer key generation and headers handling.
16+
- Middlewares: Fixed unreachable code in rate limiting; typed CORS config.
17+
- Config: Added explicit types and normalizations in `ApiConfig` and `CacheConfig` getters.
18+
19+
### 🧪 CI (GitHub Actions)
20+
- Added workflow to run Composer install, PHPStan, and PHPUnit on pushes/PRs.
21+
- Provisioned MySQL service (database: `test`) so DB-backed tests run reliably in CI.
22+
- Matrix on PHP 8.2 and 8.3.
23+
24+
### Result
25+
- PHPStan: 0 errors.
26+
- PHPUnit: All tests passing.
27+
28+
---
29+
330
## 2.0.0 - Performance & Architecture Revolution (2025-11-10)
431

532
### 🚀 Major New Features

public/index.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
<?php
2+
/**
3+
* Application entrypoint (bootstrap) for the PHP-CRUD-API-Generator.
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
12+
213
declare(strict_types=1);
314

415
require_once __DIR__ . '/../vendor/autoload.php';

src/ApiGenerator.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* Database-backed CRUD API generator.
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
212

313
namespace App;
414

src/Application/HookManager.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* Hook manager for registering and dispatching extension hooks.
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
212
declare(strict_types=1);
313

414
namespace App\Application;

src/Application/Router.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* HTTP Router orchestrating middleware and controllers.
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
212
declare(strict_types=1);
313

414
namespace App\Application;

src/Auth/Authenticator.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* Multi-method API Authenticator (API Key, Basic, JWT).
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
212
declare(strict_types=1);
313

414
namespace App\Auth;

src/Cache/CacheInterface.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* Cache driver interface definition.
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
212

313
namespace App\Cache;
414

src/Cache/CacheManager.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* Cache Manager orchestrating cache keys, TTLs, and drivers.
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
212

313
namespace App\Cache;
414

src/Cache/Drivers/FileCache.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,14 @@
11
<?php
2+
/**
3+
* File-based cache driver.
4+
*
5+
* @package PHP-CRUD-API-Generator
6+
* @author BitsHost
7+
* @copyright 2025 BitsHost
8+
* @license MIT License
9+
* @link https://bitshost.biz/
10+
* @created 2025-11-12
11+
*/
212

313
namespace App\Cache\Drivers;
414

0 commit comments

Comments
 (0)