pooQuery - The Fluent PHP Revolution!
January 21, 2008 – 8:41 pm Tags: PHP, ProgrammingWe all know that fluent programming style rocks, and jQuery is a great example of that!
Wel also know that SQL is greatly simplified with fluent style interfaces!
And so are Regular Expressions!
Now it’s time for PHP to step in the world of fluency with pooQuery!
What is pooQuery?
pooQuery - PHP Object Oriented Query - is a mini-language inside PHP. It is designed to allow for a very fluent programming style; literally to revolutionarize the way you write PHP.
It already supports many PHP features, including working with variables, calling PHP functions and working with class methods. For example, you can easily bootstrap a Zend Framework application using pooQuery-style fluent PHP.
Write PHP without knowing PHP
pooQuery is all about letting people who don’t understand PHP to write PHP using PHP. It’s also about making PHP fluent.
Compare this ugly old PHP syntax to the great new fluent style:
//Old skool PHP $variable = 'Hello World'; $variable = substr($variable, 0, 5); echo $variable;
//Great new fluency! take('Hello World')->and->call('substr')->with(array(it(), 0, 5)) ->and->take(call()->result)->and->display();
Now isn’t that simply great? Compared to old, clunky and boring syntax, you can use the newest programming breakthrough, fluent-style!
Classes are so easy and intuitive as well:
//boo $instance = new MyClass(); $instance->method(); //yay take(new MyClass())->and->assign(it())->to('instance') ->and->call(its()->method('method'))->and->finish();
Download it!
pooQuery is available under Codeutopia’s public SVN repository and as a .tar archive. There are also some phpdoc-generated docs.
Have fun and enjoy the great fluentness!

16 Responses to “pooQuery - The Fluent PHP Revolution!”
Wow, looks like RoR and PHP had a malformed child. I guess this would be great stepping stone for those coming from RoR to PHP. I guess fluency is not my style but congrats just the same.
By fearphage on Jan 21, 2008
This must be a joke …
Now that I’ve seen this post … I’m suddenly afraid of the future.
“pooQuery is all about letting people who don’t understand PHP to write PHP using PHP. It’s also about making PHP fluent.”
Sure, but it’s also making it very, very hard to read. I have to read complete Line to see what’s happening in there.
If you don’t understand something then don’t do it or learn until you’ll understand. You can drive modern car with minimal “effort” - just press few buttons - but you don’t hear manufacturers say: “People who can’t drive a car can drive this car!”
I think I’ll go and fly a space shuttle - just one button and weeeeeeee …
By Zoki on Jan 22, 2008
Oh, forgot to say … I hate all xQuery things … but for this at least the name is right … POO
By Zoki on Jan 22, 2008
I’ve already transitioned our entire company to pooQuery. Our fluency quotient is off the charts. It’s true that we’ve had to treat several “Shift-Key” strains but hey, coding is war, and in war there are casualties!
By tobyjoe on Jan 22, 2008
I would like to remind everyone to Digg pooQuery if you like it
Note: there’s a new version of pQ in Svn, which contains basic conditional support in the style of:
when(’foo’)->is->sameAs(’bar’)-> …
or
when(10)->not->greaterThan(20)->and(20)->is->sameAs(20) …
By Jani Hartikainen on Jan 24, 2008
Mmmm sorry, but dont like this.
Look harder for me, i rather use php as normal.
Maybe newer pooRQuery version worth.
By lazy on Jan 30, 2008
Gotta say that it seems like a lot more code to me. It is also apparent that it is an abstraction of php and therefore should be slower than code written in php to begin with.
just my .02
By Chas on Feb 3, 2008
Are you serious? Wow, so you’re taking PHP language operators and library functions and replacing them with an abstraction layer?
I don’t see how: “when(10)->not->greaterThan(20)->and(20)->is->sameAs(20)”
is better/easier than:
if( (10 <= 20) && (20 == 20) )
Let’s face it, to develop you need to learn some sort of language syntax. I don’t think this is any easier, and is actually harder than the language itself.
By Rich on Feb 5, 2008
Ah, man. That’s great. Gave me a good laugh.
By David on Mar 14, 2008
How anyone fails to grasp that this is a joke is mind boggling. I guess it just goes to show many ideas similar to this are actually serious so people are used to having to debunk the absurd.
By wow on Apr 29, 2008
Maybe a bit too much. Fluent style is sexy, but ends in itself.
You think that this is a neat way, but processor time and memory usage will explode.
By Tom on Jun 9, 2008
woow…thats very pretty - where can i download the code??
By R on Jul 18, 2008
Whenever I could replace a few simple words of code with many words of code, let me see…
I WOULDN’T DO IT.
By N. S. Sherlock on Jul 18, 2008