Nette 3.0.0 alpha released!

5 months ago

David Grudl
founder | 6692

Nette 3.0.0 alpha has just been released!

Nette is one of the very first frameworks that uses strict_types, scalar type hints and return type hints. Which is a fundamental step towards more robust applications.

Minimum required PHP version is 7.1 (7.0 for some packages).

This version is highly compatible with 2.4 and is intended for testing new type hints and strict_types features.

TODO: tool for automatic adding of the necessary type hints to your code.

Stages of development of individual packages

  • Security, Robot-Loader, Php-Generator, Neon, Finder, Component-Model, Caching, Bootstrap: finished, just need to be tested
  • Mail: all that remains is better API for SmtpMailer
  • Utils: all that remains is support for immutable DateTime
  • Database: resolve pull requests
  • Application, Http: on roadmap are bigger internal changes to support middlewares (current stage is early alpha)
  • Latte: on roadmap is the new API for macros with AST (current stage is early alpha)
  • Form: on roadmap are improvements including automatic CSRF protection, dynamic forms, etc
  • DI: on roadmap are improvements in Compiler extensions (priorities etc)
  • Tester: all that remains is output handlers refactoring
  • Tracy, Reflection, SafeStream, Tokenizer: new versions of these packages are not planned at the moment

BC breaks

Due to the new return type hints some method returns NULL instead of FALSE on failure:

  • Strings::before(), after(), indexOf() and pos() return NULL instead of FALSE if the needle was not found
  • Arrays::searchKey() returns NULL instead of FALSE when item is not found
  • ContainerBuilder::getServiceName() returns NULL instead of FALSE
  • Database\ResultSet: changed empty result return type of fetch() and fetchField() from FALSE to NULL
  • UI\ComponentReflection::parseAnnotation() returns NULL instead of FALSE
  • Latte\MacroTokens::fetchWord() returns NULL instead of FALSE on error
  • PhpGenerator\Method: empty body is NULL instead of FALSE
  • and Image::save() and send() throws ImageException on failure

Similary in Forms SubmitButton::setValidationScope() accepts ?array, so replace in your code FALSE with empty array []

Some classes & members are marked as final.


  • first parameter $code is deprecated in UI\Component::redirect(), use redirectPermanent().
  • UI\Component::getParam()
  • ComponentModel\Component::__construct() parameter $parent is deprecated
  • ComponentModel\Container::getComponents(): removed (unknown) child-first option
  • Http: IRequest, IResponse, Url: parameters $default are deprecated


  • SqlPreprocessor: all scalars are always passed via binding (may cause BC break in Postgresql)
  • there are changes in ISupplementalDriver (removed unused normalizeRow() and formatBool(), added formatDateInterval() and initialize()), in IStructure (added getPrimaryAutoincrementKey()) and IRowContainer (added fetchField())


  • removed deprecated support for inheritance ‘child < parent’


  • HttpExtension: uses interfaces Http\IRequest & Http\IResponse instead of Http\RequestHttp\Response


  • Helpers::formatArgs() checks for insufficient number of placeholders


  • $autoRebuild replaced with setAutoRefresh() (available since v2.4.2)
  • setCacheStorage() replaced with setTempDirectory() (available since v2.4.2)
  • RobotLoader is case sensitive


  • User::setExpiration() removed second argument $whenBrowserIsClosed and replaced with $flags (possible value IUserStorage::CLEAR_IDENTITY)


  • Validators::assertField: first argument has type hint array

5 months ago

Member | 725

I have not been here for quite a while and I see nothing has changed :) Still on the edge… of future.

5 months ago

Tomáš Votruba
Moderator | 1098

Thanks for the release! Much love for PHP 7.1!

What is the easiest step to try it out?

Is is possible to try it, when some of my dependencies lock Nette to "nette/nette": "^2.4"?

Last edited by Tomáš Votruba (2017-02-04 14:55)

5 months ago

David Grudl
founder | 6692

The only way I know is to manually replace content of /vendor/nette with Nette 3.0 and run composer dumpautoload.

I am working on automatic tool that adds needed typehints to your code.

5 months ago

Tomáš Votruba
Moderator | 1098

How to test Nette 3.0 with ease?

Last edited by Tomáš Votruba (2017-02-05 00:04)