Nette Documentation Preview

syntax
Nette Application
*****************

.[perex]
Nette Application is the core of the Nette framework, providing powerful tools for creating modern web applications. It offers a range of exceptional features that significantly simplify development and improve code security and maintainability.


Installation
------------

Download and install the library using [Composer|best-practices:composer]:

```shell
composer require nette/application
```


Why choose Nette Application?
-----------------------------

Nette has always been a pioneer in web technologies.

**Bidirectional Router:** Nette features an advanced routing system unique in its bidirectionality - it not only translates URLs to application actions but can also generate URLs in reverse. This means:
- You can modify the URL structure of the entire application at any time without needing to modify templates
- URLs are automatically canonicalized, improving SEO
- Routing is defined in one place, not scattered in annotations

**Components and Signals:** The built-in component system inspired by Delphi and React.js is unique among PHP frameworks:
- Enables creating reusable UI elements
- Supports hierarchical component composition
- Offers elegant AJAX request handling using signals
- Rich library of ready-made components on [Componette](https://componette.org)

**AJAX and Snippets:** Nette introduced a revolutionary way of working with AJAX in 2009, long before similar solutions like Hotwire for Ruby on Rails or Symfony UX Turbo:
- Snippets allow updating only parts of the page without needing to write JavaScript
- Automatic integration with the component system
- Smart invalidation of page sections
- Minimal data transfer

**Intuitive [Latte|latte:] Templates:** The most secure templating system for PHP with advanced features:
- Automatic XSS protection with context-sensitive escaping
- Extensible with custom filters, functions, and tags
- Template inheritance and snippets for AJAX
- Excellent PHP 8.x support with type system

**Dependency Injection:** Nette fully utilizes Dependency Injection:
- Automatic dependency passing (autowiring)
- Configuration using clear NEON format
- Support for component factories


Main Benefits
-------------

- **Security**: Automatic protection against [vulnerabilities|nette:vulnerability-protection] like XSS, CSRF, etc.
- **Productivity**: Less writing, more features thanks to smart design
- **Debugging**: [Tracy debugger|tracy:] with routing panel
- **Performance**: Smart cache, lazy loading of components
- **Flexibility**: Easy URL modification even after application completion
- **Components**: Unique system of reusable UI elements
- **Modern**: Full support for PHP 8.4+ and type system


Getting Started
---------------

1. [How Applications Work? |how-it-works] - Understanding the basic architecture
2. [Presenters |presenters] - Working with presenters and actions
3. [Templates |templates] - Creating templates in Latte
4. [Routing |routing] - Configuring URL addresses
5. [Interactive Components |components] - Using the component system


PHP Compatibility
-----------------

| version               | compatible with PHP
|-----------------------|-------------------
| Nette Application 4.0 | PHP 8.1 – 8.4
| Nette Application 3.2 | PHP 8.1 – 8.4
| Nette Application 3.1 | PHP 7.2 – 8.3
| Nette Application 3.0 | PHP 7.1 – 8.0
| Nette Application 2.4 | PHP 5.6 – 8.0

Valid for the latest patch versions.

Nette Application

Nette Application is the core of the Nette framework, providing powerful tools for creating modern web applications. It offers a range of exceptional features that significantly simplify development and improve code security and maintainability.

Installation

Download and install the library using Composer:

composer require nette/application

Why choose Nette Application?

Nette has always been a pioneer in web technologies.

Bidirectional Router: Nette features an advanced routing system unique in its bidirectionality – it not only translates URLs to application actions but can also generate URLs in reverse. This means:

  • You can modify the URL structure of the entire application at any time without needing to modify templates
  • URLs are automatically canonicalized, improving SEO
  • Routing is defined in one place, not scattered in annotations

Components and Signals: The built-in component system inspired by Delphi and React.js is unique among PHP frameworks:

  • Enables creating reusable UI elements
  • Supports hierarchical component composition
  • Offers elegant AJAX request handling using signals
  • Rich library of ready-made components on Componette

AJAX and Snippets: Nette introduced a revolutionary way of working with AJAX in 2009, long before similar solutions like Hotwire for Ruby on Rails or Symfony UX Turbo:

  • Snippets allow updating only parts of the page without needing to write JavaScript
  • Automatic integration with the component system
  • Smart invalidation of page sections
  • Minimal data transfer

Intuitive Latte Templates: The most secure templating system for PHP with advanced features:

  • Automatic XSS protection with context-sensitive escaping
  • Extensible with custom filters, functions, and tags
  • Template inheritance and snippets for AJAX
  • Excellent PHP 8.x support with type system

Dependency Injection: Nette fully utilizes Dependency Injection:

  • Automatic dependency passing (autowiring)
  • Configuration using clear NEON format
  • Support for component factories

Main Benefits

  • Security: Automatic protection against vulnerabilities like XSS, CSRF, etc.
  • Productivity: Less writing, more features thanks to smart design
  • Debugging: Tracy debugger with routing panel
  • Performance: Smart cache, lazy loading of components
  • Flexibility: Easy URL modification even after application completion
  • Components: Unique system of reusable UI elements
  • Modern: Full support for PHP 8.4+ and type system

Getting Started

  1. How Applications Work? – Understanding the basic architecture
  2. Presenters – Working with presenters and actions
  3. Templates – Creating templates in Latte
  4. Routing – Configuring URL addresses
  5. Interactive Components – Using the component system

PHP Compatibility

version compatible with PHP
Nette Application 4.0 PHP 8.1 – 8.4
Nette Application 3.2 PHP 8.1 – 8.4
Nette Application 3.1 PHP 7.2 – 8.3
Nette Application 3.0 PHP 7.1 – 8.0
Nette Application 2.4 PHP 5.6 – 8.0

Valid for the latest patch versions.