RegexRouter
PHP class to route with regular expressions. Extremely small.
Install / Use
/learn @moagrius/RegexRouterREADME
RegexRouter
PHP class to route with regular expressions. Extremely small. Follows every conceivable best-practice - SRP, SoC, DI, IoC, bfft...
Usage
The only actual code is RegexRouter.php. index.php and the .htaccess file are just demoing usage. The 3 together in a TLD will function.
Setup
- make sure you're sending all requests to a front controller (either through apache conf directly or htaccess)
- include or require RegexRouter.php
require_once 'RegexRouter.php'; - instantiate a new instance
$router = new RegexRouter(); - add some routes
$router->route('/^\/some\/pattern$/', <closure>); - pass it either REQUEST_URI or any string for unit testing
$router->execute($_SERVER['REQUEST_URI']);
Related Skills
node-connect
352.0kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
111.1kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
352.0kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
352.0kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
