Modern PHP Frameworks — Ubiquity vs Symlex

This isn’t going to be your mundane performance test. PHP frameworks have a decent performance comparison platform over at PhpBenchmarks. The TLDR of it is that Ubiquity and Symlex share the performance crown over different areas (Symlex has the speed and memory consumption crown for REST APIs while Ubiquity renders templates like a beast — assuming beasts do that kind of thing).

This is going to be a philosophical comparison of sorts, coming from someone who has a hard time to bid farewell to PHP after over a decade spent in its world.

While a language is a tool, the way a language is used becomes a prison over time. PHP is a prime example. Created to render HTML pages, PHP has tried to overcome its limited scope and interpreted nature by reaching all over the place. Do it all in PHP, I say and embrace the resulting monolith. Worse yet, take your cues from other languages.

From Zend Framework to Symfony, there have been numerous attempts to create the perfect framework. Did I just say framework? I mean, rapid application development platform. I think there’s a difference.

A framework merely guides you with structure and perhaps a mindset or an approach to doing things. It reduces the boilerplate somewhat, more by providing a way for third parties to tool it than providing everything. If you run into trouble, the only ones really limiting you are the issues with the very core of the framework.

A rapid application development platform offers you everything in one place. The more moving parts you have (container, routing, http wrappers, tooling, templating, etc), the more ways things can go wrong in a way that will have you shifting everything around.

Symfony is a prime example. A rival for Zend, it took over the first spot and in doing that brought into the spotlight the shortcomings of the language and of itself. Let’s Java ourselves to death. Let’s over-OOP our code on the footsteps of a compiled language and hope that our interpreter and extra tooling (Apache, NginX) can make up for that.

Symlex takes the radical approach. The descendent of the now defunct Silex framework, Symlex strips away everything except a few core items (routing, container) and tiptoes around things like templating. It is a framework in the true sense of the way, with a few shortcomings in the ways of lacking documentation (but great community!). As a developer you should study the framework’s code (ew!) and take your cues from a handful of examples. On the other hand, it’s extremely lightweight to the point where you may need to reinvent some wheels.

It still pays some tribute to Symfony and Silex, but shuns bundles altogether and keeps things neat, to the point where you may consider Symlex for APIs and/or microservices (though I shall taunt you for considering PHP for this anyway).

Ubiquity (2.0) is more of a rapid application development platform in the footsteps of Symfony. Where Symlex strips things through and through, Ubiquity keeps the RAD approach by foregoing Symfony’s resemblance to Java frameworks and goes full steam ahead to showcase its PHP-ness (don’t instantiate everything, don’t wrap your arrays in garbage, discourage third party dependencies).

Nowadays I’m mostly partial to Golang but after running into Symlex, I’ve drawn some parallels between Gin framework and Symlex. While not the best microservice-oriented framework, Gin is lightweight and versatile much like Symlex.

It’s great to see uses of PHP that don’t try to re-create structures from other languages in itself (particularly Java, where the heavyweight enterprise-y titan is reimagined as Kotlin).