Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Application Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Getting Started

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.

Implementation Patterns

  • Presenter architecture: Treat presenters as lightweight controllers—no business logic. Use actions (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()).
  • Template lifecycle: Override 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.
  • Routing & Links: Use 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.
  • Dependency injection: Mark presenter methods with 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.

Gotchas and Tips

  • Template unserialization: Nette blocks template deserialization by default (security hardening since v2.4.15/v3.0.5)—avoid storing templates in sessions.
  • Strict routing behavior: PHP 8.4+ compatibility (v3.2.6) and union types (v3.0.8, v3.1.4) require precise type hints; invalid links now throw InvalidLinkException instead of silent failures. Check Application::$error4xxPresenter (v3.2.1) to customize 4xx error handling.
  • PHP 8.5+ pitfalls: Ensure your Presenter::run() and Component::tryCall() handlers account for BadRequestException extending LogicException (v3.1.15); avoid deprecated @deprecated annotations—use the #[Deprecated] attribute instead.
  • Extension quirks: Latte’s |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).
  • Debugging: Use 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.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport