As the saying goes, "Just because you can do something doesn't mean you should." But in the world of programming, stretching boundaries is just part of the fun. The PHP community has never been one to shy away from bending their favorite language more ways than a shopping mall pretzel, and as the ten wild projects introduced in this article indicate, the fervor for experimentation is as strong as ever!
Because of the language's decades-long popularity, quite a few Lisp dialects have sprung up over the years. For instance, you might have heard of Common Lisp and Scheme. MinHee Hong has made his contribution to this long list, creating LisPHP, a Lisp implementation written in PHP. Although only a few months old at the time of this writing, LisPHP already supports an impressive set of features, including an interactive command-line programming environment.
I'd imagine most readers are at least vaguely familiar with the.NET Framework, a software environment that supports conceivably any programming language. Among the languages currently able to run within the .NET environment are IronPython and IronRuby.
Thanks to Phalanger, you can add PHP to this growing list. This active project opens up a whole new array of wild possibilities for PHP developers, including the ability to create PHP-driven Silverlight applications, use PHP as a language for building ASP.NET applications much in the same way you would use C#, and even create console and traditional client-based GUI applications. Further, the Phalanger developers have been able to impressively keep stride with the core PHP development team, having already implemented many of the features found in PHP releases as recent as 5.3.1.
For some proof that Phalanger is not just an academic pursuit, check out the list of high-profile PHP projects capable of being run atop Phalanger.
Some years ago I had the pleasure of attending a special Microsoft event in which .NET creator Anders Hejlsberg introduced another impressive technology known as LINQ (Language Integrated Query). LINQ helps to reduce what is often referred to as the "impedance mismatch" between various data-management paradigms such as relational databases and XML and object-oriented code by providing a data-query syntax that is natively recognized by the programming language.
Last year Maarten Balliauw brought a LINQ implementation to PHP with the release of PHPLinq, a class library that allows you to query data structures such as arrays, XML, and databases using PHP's familiar method-chaining syntax. For instance, check out this example (taken from Balliauw's blog post on the topic):
// Create data source$names = array("John", "Peter", "Joe", "Patrick", "Donald", "Eric");$result = from('$name')->in($names) ->where('$name => strlen($name) < 5') ->select('$name');
Similar syntax could be used to query other data sources, meaning PHPLinq can eliminate much of the need to adjust your approach to data access and manipulation simply because the data source has changed.
PHP's bread and butter has long been its ability to create powerful, dynamic Web sites. But what about desktop applications? That's precisely the PHP-GTK project's intent, and I guarantee you'll be surprised by just how far you can push PHP's boundaries in this regard. Thanks to this project's PHP implementation of the GTK+ language bindings, you can create applications as sophisticated as the Teak Email client presented in Figure 1.
Although it appears as if progress on the PHP-GTK project has slowed as of late, the years of development that have already gone into PHP-GTK have left it an immensely capable project.
A few years ago Neal Ford penned a blog post that to this day has had a major impact on the way I think about programming. The post, titled "Polyglot programming," promoted the idea that using multiple languages to power a web application will actually decrease rather than increase its complexity because you'll be able to selectively use each language to implement features that would be hard to implement in other languages.
Enter Quercus, a 100% Java implementation of the PHP 5 language. This implementation opens up a whole new world of possibilities for both PHP and Java developers, allowing PHP developers to take advantage of technologies such as Hibernate and Spring, while giving Java developers the opportunity to use PHP's vast assortment of extensions such as SimpleXML and PDF.