Jan '15


Introducing Nice, a microframework for PHP 5.4+

Nearly a year ago, I began working on a pet project for use at my company, Terramar Labs. We had a need for a simple web application framework that wasn't a bear to get up and running and could still perform most functions. We needed a simple PHP-based platform for fast prototyping and quick deliverance of proof-of-concepts. Our "real apps" were built using Symfony 2, but getting a Symfony application properly set up and deployed can take more time than building a prototype!

So we looked into other options. We had used Silex and Slim, but both had a glaring problem. Once you make the decision to actually go with an idea and start heavy development, you have to throw away nearly everything and start from scratch. Neither Silex nor Slim are suitable for large-scale application development: they both suffer from dependency hell, with magical Pimple factories and poorly defined Slim dependencies. We needed something that could scale up in terms of features, without becoming a huge maintenance nightmare.

A natural decision was to make use of the Symfony 2 components, much like Silex. Unlike Silex, we wanted to leverage the Symfony 2 Dependency Injection component rather than Pimple. We had long been used to the power of the Dependency Injection component, but it can be a beast in and of itself, so we built a simpler interface to Symfony's DI Container...


Nice, dude.

Nice is a microframework for PHP 5.4+. It is easy to set up, simple to extend, and, best of all, Nice apps can grow in size without becoming a huge, tangled mess. Leveraging the power of Symfony 2's DI component to create configurable Extensions, and Compiler Passes, we could rapidly create prototypes using a workflow similar to how we built Symfony apps. And that's not to mention the considerable performance increase from utilizing Symfony's Config component's ConfigCache to cache generated data like route mappings, URL generation data, and the compiled DI container itself -- just like Symfony 2 apps!

Nice comes with built-in integration with Monolog and optionally, DI extensions for Twig and various Doctrine projects are available. Implement basic authentication with Nice's simple security component or build your own extensions to power your application. And since Nice uses the Symfony 2 HttpKernel at its heart, it is completely compatible with Stack middlewares!


So what?

Today, Nice reaches 1.0 and stability. Its API has been vetted through nearly two dozen prototypes, with a few still running and being used. One project, Packages, has itself been a proving ground with its latest versions making great use of Nice's extensability and features. In addition to Packages, Nice powers two other in-house applications used for call center representatives and basic load balancing every day.

The future is bright for Nice, with modular development allowing a stable API that can be counted on and used for any type of application. Additional extensions are being planned, including a CLI extension, Doctrine ODM extension, and full integration with the Symfony Security component.


Give it a try!

Follow the getting started tutorial and whip up a quick application. You might be surprised!



Shea Lewis

Nice documentation!