Go get it! In this release, I’ve deprecated the dependency on the Twig templating system. Don’t get me wrong – Twig is fantastic! However, I was only using the tiniest bit of its functionality, and it was really a heavy-handed approach to a simple problem. I refactored the code into a pure PHP alternative in maybe 10 minutes.
Having Twig exposed an issue with both WordPress and PHP (One I should have foreseen, actually). In WordPress, it can be a real challenge to have multiple copies of the same third-party library in the same install. To wit, if two plugin authors both include the standard Twig package, the second authors plugin won’t activate because Twig is already instantiated. Sure you can check to see if Twig already is declared and simply use that instance, but there’s no guarantee that they’re using the same version. If they’re using an older version and you try to use a feature included in the newer version, you’re out of luck.
Namespacing or class nesting could solve the problem. However, PHP doesn’t implement those features well enough (or at all, in the case of class nesting) to solve the basic issue. It would be fantastic to be able to open a new PHP file, declare a namespace, and require Twig, then Twig would be sitting all pretty and ready to go under my own umbrella namespace. Class collisions would be near-impossible.
My opinion of PHP, in general, has changed since I wrote my little post about PHP being web legos. If wielded correctly, PHP can be a fantastic language to work with. But occasionally you still get the feeling that OOP was sort of bolted on (and it was), and miss some of the things you get when a language is object oriented from day one.