Update: I finished everything that I had planned to do... So, unless someone else finds this project interesting, I believe that I am done working on it for now. Mainly because there are better/more-mature projects out there.
If the name of this project isn't enough to let you know what it is, this is a Sinatra clone in PHP. Currently this is not a serious project, just a little something for me to try and learn a little more about PHP.
My background is mainly in Ruby and I have a strong love for Sinatra. So, I'm taking about the task to implement the basic feature-set that is present in Sinatra. Mainly the minimalistic route matching and hooks that Sinatra exposes for whipping up dandy little web-apps/api's very quickly.
A simple hello-world example in good 'ole Sinatra fashion:
# index.php
require 'pinatra.php';
Pinatra::get('/hi', function () { return 'Hello World!'; });
Pinatra::run();
php -S 0.0.0.0:8181
Before hooks:
// before everything, set a custom header
Pinatra::before('*', function () { header("MyApp: v${version}"); });
// before user's view their profile, force an update of
// their stream (silly example)
Pinatra::before('/user-profile/:id', function($id) {
update_user_stream($id);
});
After hooks:
// update site's hit-counter (also silly, but you get the point right?)
Pinatra::after('*', function () {
update_site_hit_counter();
});
This little framework is only compatible with PHP v5.4.x since it was just for fun and I don't care about any sort of backwards compatability.
The items that I will be adding/implementing next are (roughly) as follows:
Parametric URIs (variables actually passed to the handler functions)Refactoring of handle_request functionConfiguration blocksTesting before and after hooks(working)POST functionalityPUT functionalityDELETE functionalityHEAD functionality
This project is dead.