Route66
Simple php router standalone
Install / Use
/learn @eleazan/Route66README
Route66
Description
Route66 is a simple PHP router standalone.
Usage
Include the file, and, use his methods get, post, put or delete
You can use with something like
$router = new Route66();
$router->get("/", function() {
echo 'That\'s the index';
});
$router->get("/blog", function() {
echo 'Show the blog page';
});
$router->get("/blog/{post_id}", function($post_id) {
echo 'Show the post: '.$post_id;
});
$router->post("/blog/{post_id}", function($post_id) {
echo 'Now, we can modify the post: '.$post_id
});
$router->delete("/blog/{post_id}", function($post_id) {
echo 'We can delete the post: '.$post_id;
});
$router->put("/blog", function() {
echo 'And this, can be for insert a new post';
});
And a .htaccess like
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php [L]
</IfModule>
####Alternative usage
You can use without anonymous functions:
$router = new Route66();
$router->get("/", "Views::Index"); //Calls the Views class, Method Index
//OR
$router->get("/", "viewsIndex"); //Calls the function viewsIndex
Subdirectory
If you are using a subdirectory, you can use setPath() for avoid conflicts
$router->setPath("/api");
Put & Delete
If your browser doesn't accept these methods, you can do it with a POST, and set the variable _method to PUT or DELETE
Related Skills
node-connect
339.3kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
83.9kCreate 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
339.3kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
commit-push-pr
83.9kCommit, push, and open a PR
