PHP framework gives developers control over MVC

The new framework, called Bastard, works with the Nginx HTTP daemon

Equipped with a peculiar name and described as a "really bad PHP framework" by its own creator, the newly unveiled Bastard framework leverages the Model View Controller development pattern but lets developers build the MVC functions themselves.

Built to work with the Nginx HTTP server, Bastard is so named because is "a small, quick, and dirty framework," developer Dave Smith-Hayes, a college student in Toronto, said.

The framework is described as loosely MVC in nature. Developers create their own controlers, views, and models from scratch based on their own ideas, Smith-Hayes said. "You're not inheriting from a Controller class or a View class -- unless you want to build something that way -- you're just writing code to get a job done."

What makes the framework bad? Smith-Hayes says the description is a bit of  double-edged sword. "It really abuses two things to make it function properly: the Nginx rewrite engine for incoming requests, and the PHP super-global variable $_SERVER['REQUEST_URI']. With the exception of the CSS files -- and soon JavaScript -- every single request is filtered through the root directory's index.php file. This creates a bottleneck-style landing page for all types of requests." This may prove detrimental if a website has extremely high volume, though Smith-Hayes said he does not have the means to test this hypotheses.

However, developers leveraging this scenario also have absolute control over what faces the world from their server, he said. The term "bad" is not intended to be sarcastic, Smith-Hayes explained. The word "bad" is meant to note how the framework does things a little differently and some people are not going to like that, he said.

Developers can work with designers and clients to build quick, scalable applications. Smith-Hayes added that there is not a large market for PHP software built exclusively for Nginx, but he believes it is "kind of neat" to have something functional for the world to see. He describes the current version as a 0.1 early-stages beta release. Bastard is hosted on GitHub. "As I add more features and write and rewrite the functionality, that number will slowly inch up toward 1.0, which I guess will be the stable release." This week marked the first time source code was published in a public setting.

This story, "PHP framework gives developers control over MVC," was originally published at InfoWorld.com. Get the first word on what the important tech news really means with the InfoWorld Tech Watch blog. For the latest developments in business technology news, follow InfoWorld.com on Twitter.

Mobile Security Insider: iOS vs. Android vs. BlackBerry vs. Windows Phone
Recommended
Join the discussion
Be the first to comment on this article. Our Commenting Policies