Releases: mathsgod/light-server
Releases · mathsgod/light-server
Release list
v1.4.0
v1.3.0
What's changed
- Add
HEADrequest support with automaticGETfallback and empty response bodies. - Improve dependency injection for defaults, nullable parameters, scalar types, union types, and unresolved dependencies.
- Support
pages/at the project root when usingpublic/index.php. - Support custom
options()handlers and distinguish normalOPTIONSrequests from CORS preflight requests. - Harden CORS configuration by rejecting wildcard origins with credentials and preserving
Vary: Origin.
Verification
- PHPUnit: 37 tests, 64 assertions passing.
v1.2.1
v1.2.0
What's New
🆕 Features
- CorsMiddleware — built-in CORS preflight handling; OPTIONS requests intercepted before routing, returns 204 with CORS headers; all other requests get CORS headers appended
- SecurityHeadersMiddleware — adds common security response headers (X-Content-Type-Options, X-Frame-Options, X-XSS-Protection, Referrer-Policy, CSP)
- Graceful missing
pages/directory — server starts normally with no routes instead of crashing
🔧 Improvements
- PHP 8.1 type hints across all source files
strict_types=1added toMethodMiddleware.php- Extracted
resolveRoutePath()method inServer.phpfor cleaner route registration - Improved test coverage: 24 tests, 38 assertions
🐛 Bug Fixes
- Fixed
ReflectionUnionType::getName()fatal error on union type parameters - Fixed
error_reporting(0)silencing errors — now throwsErrorExceptionviaset_error_handler() - Fixed double-slash routing when app is at web root
- Fixed
getRootPath()undefined index and inconsistent key usage
📖 Documentation
- Complete README rewrite with routing table, DI docs, attribute middleware, route constraints, and CORS middleware sections
- Added
descriptionto composer.json
1.1.0
1.0.5: ✨ fix(MethodMiddleware): 修正輸出處理以正確返回文本響應
* 在 `process` 方法中,將 `ob_get_clean()` 的結果賦值給 `$output` 變數。 * 確保當返回值不是 `ResponseInterface` 時,能夠正確返回 `TextResponse`。