You start working on a project. Even in these early stages you should know how the URLs going to look like because you simply need to put something in that href.
Not with Nette!
Nette lets you use links in templates as if they were pointing to methods in Presenters(Controllers). Such as:
And later on when you get the idea of your project structure you define all the URLs with simple routing configuration:
You're asking what does that 'two-way' approach mean? Well it creates the URLs by the routing definition as well as matches them from incoming requests.
All smooth in one place. That's the Nette way!
Ugly piece of code from our team project generating list of people and their friendship status:
Would look with Latte (Nette templating system that is also working standalone!) like:
Syntax highlighting and more with Nette NetBeans plugin.
N-attributes give you the power of controlling HTML elements with ease.
Look at line 1 - if the user is not logged in the paragraph is to be shown!
Line 4 says give me the list of people and iterate for each of them create a new <p>.
Line 5 lets you see how easily you can print escaped strings. That is indeed the most useful Macro.
Our escaping is a fancy girl! It uses Context-Aware Escaping - escapes differently in HTML, JS, XML, CSS contexts. Safety first!
Wanna see other example of macro? Look at all those {if}s. And there's much more(official documentation)
That's basically a function that takes the left operand as a parameter. Capitalize is predefined, heShe prints either "he" or "she" depending on the sex of the $person!
You should definitely have a look at other predefined helpers(official documentation).
No performance issues here! All templates are translated into raw PHP and saved in files.
Nette provides a developer with handy Debug bar.
Debug bar also allows developer to show dumped variables, SQL statements queried to database and much more.
When an error or exception occurs, Nette contains excellent debuggin tool that allows developer to ses the whole stack trace as well as function arguments and enviromental properties.
Following code snippet generates HTML5 valid code as well as javascript client validation
Lines 10 and 12 show you how easily you can set up validation rules.
XSS and
CSRF threats are avoided.
More on forms in official documentation
Just to mention:
- MVC design pattern
- Dependency Injection
- Namespaces
- Database layer & ORM
- Unit-testing tools
- Sending Emails
- Localization
- User Authentication & Authorization
See examples on GitHub or have a look into sandbox project.
That is the skeleton you can download and kick off your project with.
There's a brand new QuickStart tutorial that walks you thru your first application!
The modern way of installing PHP libraries is thru Composer. Composer also let's the developer to manage dependencies. Find Nette on Packagist.
When you have Composer running on your machine, creating new Nette project is as simple as typing following in a command line:
$ composer create-project nette/sandbox your-project-name
You can also download the latest version as a .zip file. Unpack it and start using it.
If you feel adventurous here's .zip dev version. Or get it from straight from GitHub!