nette/application
Nette Application is the web framework core of the Nette stack, providing MVC architecture with presenters, routing, DI integration, HTTP handling, and error/debug support. Build secure, structured PHP web apps with clean separation of concerns.
Install via Composer: composer require nette/application. Bootstrap the application in your front controller (index.php) by creating an Application instance with a Router (e.g., SimpleRouter or RouteList). Create presenters (e.g., HomepagePresenter) extending Nette\Application\UI\Presenter; implement renderActionName() methods for GET requests and handleSignalName() for AJAX POST/DELETE/PUT signals. Templates go in templates/PresenterName/actionName.latte. Use #[Persistent] on properties to persist values across requests (e.g., pagination state), and #[Parameter] to bind route parameters to method arguments or properties. First use case: build a simple list page—define renderList(int $page = 1) in ItemsPresenter, fetch data, pass it to the template, and render templates/Items/list.latte.
render*) for primary page rendering, signals (handle*) for state-changing AJAX interactions (e.g., handleDeleteItem($id)), and controls (createComponent*) for reusable UI widgets (e.g., createComponentSearchForm()).createTemplate(?string $class = null) to inject custom templates; use #[TemplateVariable] on presenter properties to auto-expose variables to Latte templates (v3.2.9+). In templates, leverage |absoluteUrl filter (v3.2.7), {linkBase} tag, and n:snippet for partial updates.RouteList with annotations or #[Parameter]/#[Persistent] to define clean URLs. Generate links with $this->link() or href={link ...}; avoid broken links by using #[Requires(forward: true)] (v3.2.9) to enforce redirects for state-changing actions. Enable link aliases (v3.2.3) for refactoring-safe URL paths.inject* or type-hinted constructor parameters for automatic service resolution. Leverage PHP 8 attributes (#[Persistent], #[Requires], #[Deprecated], #[Parameter]) for declarative configuration instead of annotations or YAML.InvalidLinkException instead of silent failures. Check Application::$error4xxPresenter (v3.2.1) to customize 4xx error handling.Presenter::run() and Component::tryCall() handlers account for BadRequestException extending LogicException (v3.1.15); avoid deprecated @deprecated annotations—use the #[Deprecated] attribute instead.|absoluteUrl filter (v3.2.7) and {translate} tag (v3.1.6) require LatteExtension initialization—verify latte service exists in Tracy panel. scanDirs priority over robotLoader (v3.0.3) may cause conflicts if misconfigured—prefer explicit mapping (v3.2.1).Presenter::findTemplateFile() (v3.1.13) and RoutingPanel (redesigned in v3.1.11/v3.2.3) to trace template resolution and route matching. Watch for ComponentReflection::getActionRenderMethod()/getSignalMethod() (v3.2.3) to validate method signatures.How can I help you explore Laravel packages today?