Posts

The Frills

I don't like ORMs. I really don't. It's not just because all of the ORM frameworks I've seen make mockery out of performance needs, but they also tend to be extremely over-engineered, which makes me want to cry. I'd wager that most people using ORMs are actually solving the wrong problem with the wrong solution, simply because there wasn't a better alternative for their data-modeling needs and the benefits of adopting an ORM outweighed its inherent problems.

It's like driving a gasoline-hungry car. You say that you care about its MPG rating, but you are still wasting a lot of gas without ever looking back. It is just a cost of living. Or insurance: You know you can save 15% or more... but you don't. You've accepted that bi-annual rip-off as cost of living.

Just like using an ORM, you have accepted the pain as cost of living. Well, I don't :)

ODS - Object<->Document Serializer The new MongoDB PHP driver includes an experimental ODS inter…

Next Generation MongoDB Driver for PHP!

For the past few months I've been working on a "next-gen" MongoDB driver for PHP -- codename "phongo".
The aim was to build a new PHP extension ontop of the mongoc and libbson libraries to reduce maintenance of the extension itself and focus more on providing the ecosystem with improved support and libraries.

The new driver is available on PECL (called "mongodb", surprisingly enough). It doesn't include any of the bells and whistles found in the previous "mongo" driver. It doesn't include any `group` or `count` command helpers, and you won't find any Collection or Database objects; however, it really doesn't need any of these things.

All it has is simplicity. You can execute a command of your choosing. You can execute a query. You can execute a write. That's really it (as with everything, there are certain exceptions). Oh, it is also very, very fast.

What's the Point? Most developers interact with databases these da…

Going tableless

Tableless html was all the rage a decade ago -- for a good reason.
One of the advantages was maintainability of the markup -- especially in a deeply nested table layout.

It also turned out, the table layout didn't actually fit the way we wanted to present the data. The rigid structure it enforced wasn't what we were after - and it also limited the freedom designers had to push forward and create next generation website and application layouts.

In the beginning though, it really was the only way to get stuff done -- and the best tool for the job. It was fun while it lasted -- but we are over it now.


Today -- we are entering a similar situation -- in databases, of all places.
Tableless databases are becoming all the rage today -- for a good reason.
One of the advantages of going tableless db is maintainability of the data -- especially with deeply nested data.

It turns out, the table schema doesn't fit the way we want to work with or present data. The rigid structure it enfo…

I have a dream

I am happy to join with you today in what will go down in history as the greatest demonstration for freedom in the history of our nation project.
Today we will revolutionize PHP.
- We will make it easier to upgrade the things you care about[1].
- We will make it easier to not upgrade things you don't want to upgrade[2].
- We will make it easier to distribute your extensions[3].
- We will make it easier to release according to your own schedule[4].
- We will make it easier to add functionality[5].
- We will make it easier to work.


Ok, today is a white lie here maybe... I haven't actually implemented this, but bear with me here for a second.

- Wouldn't it be great if PHP would just be language/syntax things?
- Wouldn't it be great if you could upgrade an extension you use independently from anything else?
- Wouldn't it be great if you could get your hands on the new intl/mysqlnd/MongoDB/curl/whatever features without needing to upgrade PHP and everything else?
- Wou…

Query logging and profiling in MongoDB

In my previous blog post I mentioned that the 1.5.0 release of the MongoDB driver for PHP has improved notification support using the PHP Notification API, and showed off a fairly useless (but fun) progress bar.
Now its time for a little bit more practical examples using this system: Query logging and profiling.

Those of you who clicked through to the github Pull Request may have noticed the long long description of the API and noticed all the different "MONGO_STREAM_NOTIFY_LOG_xxx" constants it included..

When instantiating MongoClient you can pass in "Driver Options" using the 3rd argument. Currently there is only one available Driver Option: "context".

The context key takes a Stream Context, and is assigned to all of the underlaying connections the driver creates - which means you can set any of the Socket Context and SSL Context options and it will Just Work (maaan.. that saved me a ton of work.. Not needing to implement any of the SSL things myself!)…

PHP Stream Notifications ❤ MongoDB

PHP Streams have several pretty nifty features that most people don't really know about; Filters, Wrappers, Context, and Notifications. Documenting these is a bit difficult, and getting the user to discover these features is even more problematic, as these things usually live outside of the normal path (function reference).
Maybe I'll blog about these things in the future, but for now I want to talk about the Stream (context) Notifications - or more specifically; Stream Notifications in the MongoDB extension for PHP.


The Stream Notifications are essentially pretty simple: when a stream does something, it notifies something (a callback function) that it did something (notification codes, importance, message code, ..).
Since this feature is a little neglected and people don't seem to know about it, this "something happened" isn't really a lot of things. When PHP reads from the http stream it will tell you if it came across a "redirect header", "m…

New PHP.net designs floating around

Since 2008 there have been numerous efforts to create a new design for www.php.net, all of which have failed - so far.
We've never come as close as two years ago, when the "beta mode" option was added to our website, but we never really got around to finish it.
The "beta design" has even received a lot of makeover compared to what is "beta mode" now.
To make things a little bit more awesome, there is also a new branch called "responsive" which has a lot of changes in it too, especially for manual pages.

Hopefully, one day, we'll actually finish one of these and flip the switch forever.

In the meanwhile, I'm working on retiring my little baby, PhD, as I want to encourage more people to get involved with the overall project, especially the neglected parts like documentations.
It doesn't help anyone to be greeted with a "ohh, btw, you have to have a doctorate to be able to work on the docs" like "almost" is the c…