Twitto: A web framework in a tweet
twitto.org
twitto.org
$c=new ReflectionClass('co');$m=$c->getMethod($_GET['m']);if($m && $m->isPublic()){$i = $c->newInstance();$m->invoke($i);}
Example usage: <?php
// "Framework"
$c=new ReflectionClass('co');$m=$c->getMethod($_GET['m']);if($m && $m->isPublic()){$i = $c->newInstance();$m->invoke($i);}
// Controller
class co
{
public function index()
{
echo "index!";
}
public function test()
{
echo "yes, it's test.";
}
}
?>
Call:example.com/?m=index example.com/?m=test
Nice. You should call it TwitOO.
IMHO, attitude towards PHP is a great way to tell if someone really codes or just quotes the current hype. People that actually build stuff appreciate PHP's ease of deployment and scaling, even if its weaknesses make many coders (self included) choose other tools most of the time.
I don't agree with this. Yes, everyone knows PHP is easy to deploy, and it's faster than the ruby/pythons etc. But it's an ugly mess with a long history of security problems and a design that flows against the principles of well designed architecture. I know plenty of people who "really code" and abhor PHP.
I know what you mean about "trendy" language snobbishness being a hallmark of someone who doesn't actually know what they're talking about, but in PHP's case I think there is a case for informed people having strong, negative opinions.
Doesn't excuse the Reddit behaviour, of course, I don't miss that one bit. Just sayin'...
When you spend every day for months writing methods like __get and __set and so on, and try to work around the other busted aspects of the object model, it can get to you.
(Sorry for the alliteration.)