nette/php-generator
🐘 Nette PHP Generator: generates neat PHP code for you. Supports new PHP 8.5 features.
v4.2.2
79M downloads/mo
#324 most downloaded on Packagist
nette/php-generator
What this package is like to depend on
Last release 5 months ago
26 Feb 2026
Ships fairly regularly
a new release about every 3 months
Rarely documented
notes for 9 of 78 stable releases
Nothing withdrawn
no release was ever pulled
12 years old
78 releases · first in 2014
2 releases in the last 12 months
see the full history below
Release timeline
78 releases · Jun 2014 to Feb 2026Releases
latest 60 of 78-
v4.2.226 Feb 2026Release notes
Open source →This release focuses on making namespaces and classes work together more naturally. Classes now know which namespace they belong to, constructors accept fully qualified names, and a new unified
add()method on PhpFile ties it all together. Under the hood, the Factory got a thorough refactoring and the codebase passed its first mandatory static analysis check.-
PhpNamespace::add() now automatically assigns itself as the namespace of any ClassLike passed to it. If your code relied on
getNamespace()returningnullafter adding a class to a namespace, you'll need to update that assumption. -
PhpFile::add() – a single entry point for adding classes, interfaces, traits, enums, functions, and namespaces to a file. It handles namespace creation and bracket syntax automatically, so you can build a complete file with just
add()calls. -
ClassLike::getFullName() – returns the fully qualified name when the class belongs to a namespace (e.g.,
App\Model\User), the short name otherwise, ornullfor anonymous classes. -
ClassLike constructors now accept FQN – pass
'App\Model\User'and the namespace is extracted automatically. No need to create the namespace separately for simple cases. -
PhpNamespace::add() accepts GlobalFunction – the unified
add()method now handles functions alongside class-like types, making the namespace API more consistent. -
The
$namespaceparameter in ClassLike constructors is deprecated. UsesetNamespace()instead. The old signature still works for now, but will be removed in a future version.
-
-
v4.2.109 Feb 2026Nothing published for this version
-
v4.2.006 Aug 2025Release notes
Open source →- requires PHP 8.1
- Visibility, PropertyHookType & PropertyAccessMode are enums (BC break)
- removed deprecated stuff
- addTrait() second argument is deprecated (BC break)
Release notes
Open source →OAuth 2.0 authentication for Gmail and Microsoft, one-click unsubscribe headers, Ed25519 DKIM signing, a real CSS cascade for inlining, and a security patch that alone makes updating worth it. Fully backward compatible.
David Grudl
about a month ago
-
v4.1.906 Aug 2025Release notes
Open source →- support for PHP 8.5
- final promoted property in PHP 8.5
- optimized global function calls
-
v4.1.831 Mar 2025Release notes
Open source →Factory::fromClassReflection()extracts property hook bodies (#172)Factory::fromClassReflection()rejects $withBodies for interfaces- improved tests
- cs
-
v4.1.729 Nov 2024Release notes
Open source →- added support for PHP 8.4 features
- properties hooks
- asymmetric visibility
- property can be abstract / final
- interfaces can have properties
- added Visibility
ClassManipulator::implement()can implement abstract classesClassManipulator::implementInterface()renamed toimplement()- PsrPrinter is not final
- Constant: type can be nullable
- Factory: fixed visibility of promoted property
- added support for PHP 8.4 features
-
v4.1.610 Sep 2024Release notes
Open source →- added ClassManipulator
- Parameter & Property:
isNullable()returns true when default value is null (possible BC break) - added TraitsAware::hasTrait method (#163)
- support for PHP 8.4
-
v4.1.512 May 2024Release notes
Open source →- added
PhpNamespace::getClass()&getFunction() - added
CommentAware::removeComment() - added
PhpFile::removeNamespace() - Factory, Extractor: sets flag readonly for promoted properties #158 (reverts "Factory: properties in readonly classes are not readonly")
- ClassType: cloning includes attributes and parameters
- GlobalFunction, Method:
from()accepts first-class callables
- added
-
v4.1.407 Mar 2024Release notes
Open source →- PsrPrinter: opening bracket on the correct line #155
- Make
ClassLike::fromreturn type assert the subclass type (BC break) (#154) Dumper::dumpArray(),dumpArguments()optimization- Dumper: simplified list with negative keys
- added parameter $overwrite to
addMember(),addMethod(),addProperty(),addConstant(),addCase()#152 - Factory: parameters 'int $foo = null' are parsed as '?int'
-
v4.1.318 Jan 2024Nothing published for this version
-
v4.1.229 Oct 2023Nothing published for this version
-
v4.1.117 Oct 2023Nothing published for this version
-
v4.1.026 Sep 2023Nothing published for this version
-
v4.0.1029 Nov 2024Release notes
Open source →Extractor::extractAll()fixed file comment parsing- Factory: $withBodies cannot be used for internal classes/functions
- Printer: fixed falsy Attribute aren't printed (#142)
- added Visibility
-
v4.0.929 Aug 2023Nothing published for this version
-
v4.0.830 Jul 2023Nothing published for this version
-
v4.0.726 Apr 2023Nothing published for this version
-
v4.0.613 Mar 2023Nothing published for this version
-
v4.0.502 Nov 2022Nothing published for this version
-
v4.0.312 Sep 2022Nothing published for this version
-
v4.0.217 Jun 2022Nothing published for this version
-
v4.0.110 Mar 2022Nothing published for this version
-
v4.0.020 Feb 2022Nothing published for this version
-
v3.6.904 Oct 2022Nothing published for this version
-
v3.6.812 Sep 2022Nothing published for this version
-
v3.6.710 Mar 2022Nothing published for this version
-
v3.6.620 Feb 2022Nothing published for this version
-
v3.6.524 Nov 2021Nothing published for this version
-
v3.6.415 Oct 2021Nothing published for this version
-
v3.6.223 Sep 2021Nothing published for this version
-
v3.6.118 Sep 2021Nothing published for this version
-
v3.6.029 Aug 2021Nothing published for this version
-
v3.5.405 Jul 2021Nothing published for this version
-
v3.5.324 Feb 2021Nothing published for this version
-
v3.5.219 Jan 2021Nothing published for this version
-
v3.5.104 Nov 2020Nothing published for this version
-
v3.5.002 Nov 2020Nothing published for this version
-
v3.4.119 Jun 2020Nothing published for this version
-
v3.4.026 May 2020Nothing published for this version
-
v3.3.409 Feb 2020Nothing published for this version
-
v3.3.320 Jan 2020Nothing published for this version
-
v3.3.203 Jan 2020Nothing published for this version
-
v3.3.122 Nov 2019Nothing published for this version
-
v3.3.020 Nov 2019Nothing published for this version
-
v3.2.305 Jul 2019Nothing published for this version
-
v3.2.215 Mar 2019Nothing published for this version
-
v3.2.127 Nov 2018Nothing published for this version
-
v3.2.029 Aug 2018Nothing published for this version
-
v3.1.427 Nov 2018Nothing published for this version
-
v3.1.309 Aug 2018Nothing published for this version
-
v3.1.226 Apr 2018Nothing published for this version
-
v3.1.130 Mar 2018Nothing published for this version
-
v3.1.016 Aug 2017Nothing published for this version
-
v3.0.509 Aug 2018Nothing published for this version
-
v3.0.426 Apr 2018Nothing published for this version
-
v3.0.330 Mar 2018Nothing published for this version
-
v3.0.226 Sep 2017Nothing published for this version
-
v3.0.111 Jul 2017Nothing published for this version
-
v3.0.018 Mar 2017Nothing published for this version
-
v2.6.426 Apr 2018Nothing published for this version