nette/component-model
⚛ Nette Component Model
v4.0.1
17M downloads/mo
#2090 most downloaded on Packagist
nette/component-model
What this package is like to depend on
Last release 2 months ago
21 Jun 2026
Ships fairly regularly
a new release about every 11 months
Some releases are documented
notes for 7 of 21 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
22 releases · first in 2014
6 releases in the last 12 months
see the full history below
Release timeline
22 releases · Jun 2014 to Jun 2026Releases
latest 22-
v4.0.121 Jun 2026Nothing published for this version
-
v4.0.014 Jun 2026Release notes
Open source →A focused, modern major release. The component model drops legacy baggage, demands PHP 8.3+, and ships a smarter monitoring system that finally behaves predictably when listeners reshape the tree. If you've been carrying around deprecated
attached()/detached()hooks or the magicgetComponents()parameters, this is your cue to clean up – the payoff is a leaner, stricter, more reliable foundation.💥 Breaking Changes
-
Monitoring handlers now fire top-down (ancestor → descendant). When a subtree is attached,
monitor()listeners are invoked from the outermost ancestor inward, matching the natural order of tree construction. The new implementation is robust against listeners that mutate the tree mid-flight: it re-checks validity before descending into children, deduplicates so the same listener never runs twice, and guards against reentry to prevent infinite loops. If your code relied on the old ordering, review listeners that depend on sibling or parent state. -
attached()/detached()methods removed. These long-deprecated lifecycle hooks are gone. Migrate to explicit callbacks: replace overriddenattached($obj)/detached($obj)withmonitor($type, attached: ..., detached: ...). Callingmonitor()with no handler at all now throws anInvalidStateException– at least one ofattachedordetachedis required. -
Container::getComponents()parameters removed. The method now takes no arguments and returns a plainarrayof immediate children (previouslyiterable). The old recursive flag and filter-type argument are gone – passing them throws aDeprecatedException. For recursive traversal usegetComponentTree()instead. The internalRecursiveComponentIteratorhas been removed. -
IContainer::addComponent()signature tightened. Now declared asaddComponent(IComponent $component, ?string $name): static. Implementations and callers must match the new return type hint. -
Nette\SmartObjectdropped fromComponent. The component no longer pulls in theSmartObjecttrait, and the magic$name,$parent, and$componentsproperties are gone. Use the explicit methods (getName(),getParent(),getComponents()) directly. -
IComponent::NAME_SEPARATORremoved. UseIComponent::NameSeparatorinstead. -
PHP 8.3 required.
-
-
v4.0.0-RC121 Jun 2026 pre-release -
v3.2.026 May 2026Release notes
Open source →A transitional release ahead of 4.0. Nothing is removed yet, this version just lights up deprecation notices on things that will disappear in 4.0, so you can get your code ready in peace.
💥 Deprecated (will be removed in 4.0)
- Magic properties
Component::$name,Component::$parentandContainer::$components– usegetName(),getParent(),getComponents()instead. - Calling
monitor($type)without callbacks – pass them directly:monitor($type, $attached, $detached). Overridingattached()/detached()in subclasses is on its way out. - Constant
IComponent::NAME_SEPARATOR– switch toIComponent::NameSeparator(the deprecation is now reported via the native#[\Deprecated]attribute).
- Magic properties
-
v3.1.427 Mar 2026Release notes
Open source →A focused maintenance release for the Component layer. The headline is hardening of the monitor callback machinery: nested re-entry is now safely guarded, callbacks are normalized to
\Closurefor consistent deduplication, and the whole codebase has been brought under mandatory static analysis withnette/phpstan-rules.- Reentry protection for monitor callbacks –
Component::refreshMonitors()now refuses to re-enter itself while listeners are running. If a listener removes and re-adds the same component (or otherwise triggers another refresh), each component is processed exactly once instead of looping or double-firing. - Reliable callback deduplication – switched the in-array check for monitor callbacks to loose comparison. Closures are never
===to each other unless they are literally the same instance, so the previous strict check silently let duplicates through. - Adopted
nette/phpstan-rules– stricter ruleset enabled, with a dedicatedtests/types/component-types.phpdriving type tests.
- Reentry protection for monitor callbacks –
-
v3.1.322 Nov 2025Nothing published for this version
-
v3.1.206 Aug 2025 -
v3.1.107 Aug 2024 -
v3.1.008 Feb 2024Release notes
Open source →- requires PHP 8.1
- uses PHP 8.1 features
- added
Container::getComponentTree() Container::getComponents()parameters are silently deprecated, returns array when $deep is false (BC break)
-
v3.0.309 Jan 2023 -
v3.0.225 Aug 2021Nothing published for this version
-
v3.0.121 Apr 2020Nothing published for this version
-
v3.0.020 Feb 2019Nothing published for this version
-
v2.4.020 Mar 2018Nothing published for this version
-
v2.3.111 Jul 2017Nothing published for this version
-
v2.3.017 Jun 2016Nothing published for this version
-
v2.2.512 Dec 2016Nothing published for this version
-
v2.2.406 Oct 2015Nothing published for this version
-
v2.2.311 Jul 2015Nothing published for this version
-
v2.2.216 Jun 2015Nothing published for this version
-
v2.2.106 Feb 2015Nothing published for this version
-
v2.2.024 Jun 2014Nothing published for this version