Nette PHP Framework: Introduction
It was nice to find the website of this framework quite randomly in the second half of the business hours. New frameworks are rare, and even more rarely you come across mechanisms that are liked at first sight. Therefore, I would like to share my discovery with you.
First, I liked its name Nette right away. It's almost like a Latte. Only Nette as it turned out later is the Latte that has its own built-in template engine. Oh.
Second, at first view it created an impression of something new and advanced (they are almost as thoughts of the PHP team, pluging in the genius language the traits, and forgetting the boring Unicode):
- PHP 5.3
- Built-in HTML template macros
- Context-Aware Escaping technology
- Configurations in the curious NEON format, on basis of which is generated PHP code
- Own implementation of the base class for objects Nette \ Object
- Events and subscription
- New streaming protocol safe :/ / for an atomic access to the file system
Third, as it turned out, Nette is a national framework. This framework is written by Czech programmer David Grudl quite a long time ago in 2004. However, the code became publicly available just in 2008. According to the information on this site, Nette is the most used and popular PHP framework in the Czech Republic. In particular, the official website of President, Václav Klaus is based on its framework.
I should say that in the framework description were met many interesting, amusing, and most importantly, new things that I would like to learn more. Since it's not a review of the framework, but only the first introduction I will highlight the main points that I could understand.
Working with forms
In general, the functionality and structures are similar to the Zend Framework forms, but somehow it looks more easy and fresh. Instead of horrible Zend decorators are more understandable wrappers at first glance.
Own template engine
Latte with its clever macros that are built-in into HTML tags looks much more readable than the native PHP.
It is important that the template engine escapes variables by default when is outputted to a page, which does not allow forgetting about it. There is mentioned some clever Context-Aware Escaping technology that automatically allows escaping the different variables. Actually, there are enough the high-profile names in this framework. But maybe it's not so scary.
The template engine should be fast, because it compiles the templates in a pure PHP code, and stores them in cache.
In general, the template engine is simpler and more intuitive compared to Smarty.
They are very convenient. It is proposed to write them in the format of NEON. A very interesting format, probably it will add some readability to the huge trees of configurations. They could be divided into the files and merged with priorities. One of the features that allows using of this framework in large projects.
There is a mechanism for the sessions with the support of the sections in order to avoid naming conflicts in large projects. It has sophisticated caching system with different types of storage for the values, tags and the priorities. The directories can be indicated for the Avtoloader, which will scan them for the presence of classes and interfaces, and it will store this information in the cache.
Instead of conclusion
I should say that the first impression sometimes could be delusive. I sincerely hope that this is not the case.
Here is the website of framework: http://nette.org/en/
|Vote for this post
Bring it to the Main Page