Nette 3.0.0 finally released! 🎉
- David Grudl
- Nette Core | 8218
After two years of hard work, a wonderful moment has come!
Application
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- uses nette/routing
- RouteList: added addRoute() & withDomain(), withPath() and withModule()
- Presenter: signal must be sent from the same origin unless they have annotation @crossOrigin (BC break)
- Presenter: persistent parameters are transmitted between traits (in addition to the class hierarchy) [Closes nette/application#183]
- LatteExtension: added option ‘strictTypes’
- error template redesign
- Application::run() counts with response
- Component, Form: added hasPresenter(), deprecated $throw in getPresenter()
- TemplateFactory: added onCreate event [closes nette/application#195] (nette/application#196)
- Template: added renderToString()
- DI extensions: are using configuration Schema
Changes
- Changed signature of IRouter:
- IRouter::constructUrl() accepts and match() returns array instead of Nette\Application\Request (BC break)
- IRouter::constructUrl() accepts Nette\Http\UrlScript instead of Url
- MicroPresenter: returns 500 instead of 404 when parameter callback is missing
- ApplicationExtension: tag
nette.presenter
replaced by findByType() - Component::getParam() triggers deprecation warning (BC break)
- Component::redirect() first parameter $code is deprecated (BC break)
- TemplateFactory: filters |normalize, |toAscii, |reverse, |url and |null are deprecated
- ComponentReflection::combineArgs() throws Nette\InvalidArgumentException and is converted to BadRequestException on higher level
- Presenter: invalid action throws BadRequestException only during startup
- ComponentReflection::parseAnnotation() returns NULL instead of FALSE (BC break)
- Presenter: returns VoidResponse when has no response
- TemplateFactory: removed $baseUri, replaced with $baseUrl
- removed Component::getPersistentParams(), persistent params are always public properties with annotation @persistent (BC break)
- Presenter::error() moved to Component
- Route: converts all scalar params to strings [Closes nette/application#185]
- Presenter: deprecated annotation @User (BC break)
- SimpleRouter: support for parameter ‘module’ is deprecated (BC break)
- Route::$styles is deprecated (BC break)
- Application::$maxLoop changed to non-static
- ApplicationExtension: presenters are not autowired
Bootstrap
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- added Configurator::addDynamicParameters() [Closes nette/bootstrap#35]
- added compiler extension SearchExtension
- added default parameter %vendorDir%
Changes
- parameters added via addParameters() has higher priority (BC break) (nette/bootstrap#56)
- Configurator: uses Compiler::loadConfig()
- Configurator::$files → $configs (BC break)
- removed support for Nette\Environment
- to $autowireExcludedClasses added ArrayAccess, Countable, IteratorAggregate, Traversable
Caching
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- added Cache::NAMESPACES and support for cleaning namespace in FileStorage [Closes nette/caching#52]
Changes
- FileStorage: always creates directories (nette/caching#47)
- FileStorage: removed <?php from cache file structure (BC break)
- removed Memcached, renamed NewMemcachedStorage → MemcachedStorage
Component-model
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- Component::monitor accepts callbacks
- added trait ArrayAccess
- Component: More informative message in case that name is not available (nette/component-model#5)
Changes
- Component::__construct($parent) is deprecated (BC break)
- Container::getComponents(): removed child-first option (BC break)
- Component: removed constructor (BC break)
- Container: name must be string, int is allowed via ArrayAccess (BC break)
- Component: attached() and detached() marked as deprecated in favor of monitoring callbacks
Database
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- Helpers::loadFromFile added $onProgress
- SqlBuilder::tryDelimite() ignores casting
::int
- MsSql support for tables, columns, indexes, foreign keys (nette/database#215)
- Selection: fixed insert spoiling PDO:lastInsertId (nette/database#217)
- SqlBuilder: fixed compatiblity with PCRE2 used in PHP 7.3 [Closes nette/database#210]
Changes
- SqlPreprocessor: scalar are always passed via bindValue() (BC break)
- ResultSet: changed empty result return type of fetch() and fetchField() methods from FALSE to NULL [BC Break]
- removed unused ISupplementalDriver::normalizeRow() (BC break)
- removed unused ISupplementalDriver::formatBool()
- ISupplementalDriver: uncommented formatDateInterval() & getPrimaryAutoincrementKey()
- added ISupplementalDriver::initialize(), is used instead of constructor (BC break!)
- IRowContainer: Added method fetchField() (BC break)
- remove old sqlite2 driver (nette/database#155)
- removed meta info unsigned, onDelete, onUpdate
- Table: moved caching related functionality to separate classes (nette/database#185)
DI
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- autowiring via Service[] (nette/di#178)
- added collections via tagged() and typed()
- added SearchExtension
- added Schema & CompilerExtension::getConfigSchema() for automatic configuration validation with PHP 7.4 support nette/di#191
- added full validation of dynamic parameters
- configs are normalized before merge
- added AccessorDefinition, FactoryDefinition, LocatorDefinition & ImportedDefinition
- Container::addService() accepts factory closures
- Minification of metadata: added option ‘di › export › types’,
tags
andparameters
- added Reference, object representing reference to @service of @\Class
- better exception messages
- Helpers::expand() expands %params% in keys [Closes nette/nette#766]
- Helpers::expand() supports %dynamic.item% for dynamic parameters
- Compiler, CompilerExtension: improved Loader extendability (nette/di#62)
- ServiceDefinition::setArgument() added [Closes nette/di#171][Closes nette/di#172]
- Processor: names of anonymous services are just numbers
- ContainerBuilder::addDefinition(null) adds anonymous service
- added PhpStorm metadata for autocompletion
- added CompilerExtension::loadDefinitionsFromConfig()
- Loader: added support for %param% in ‘include’ section [Closes nette/di#170][Closes phpstan/phpstan#2020]
Changes
- removed deprecated support for inheritance ‘child < parent’ (BC break)
- some classes & members marked as final (BC break)
- Compiler: container has declare(strict_types=1)
- removed unused PhpReflection
- Processor::filterArguments() translates @service to object Reference
- Nette\DI\Helpers::filterArguments() moved to Nette\DI\Config\Processor
- Config\Processor: options ‘class’ & ‘type’, ‘dynamic’ & ‘imported’ are aliases
- Compiler::loadDefinitions() is not static and removed first parameter (BC break)
- Compiler::loadDefinition() is deprecated (BC break)
- Compiler: processing of config files moved to new class Nette\DI\Config\Processor
- ServiceDefinition divided into Definition & ServiceDefinition
- ContainerBuilder divided into Autowiring & Resolver
- ServiceDefinition & Statement moved to Nette\DI\Definitions namespace
- renamed Nette\DI\Config\IAdapter → Adapter
- NeonAdapter: added deprecation notice for operator ?
- removed IniAdapter (BC break) (nette/di#177)
- ServiceBuilder::setType() & getType() as a replacements for setClass() and getClass()
- Compiler: added configuration option ‘type’ as replacement for ‘class’
- ServiceDefinition::setClass() parameter $args is deprecated (BC break) (nette/di#146)
- Compiler::loadDefinitions() renamed to loadDefinitionsFromConfig(), better deprecation messages
- InjectExtension: tag ‘inject’ changed to ‘nette.inject’
- DIExtension: tag ‘run’ is deprecated (BC break)
- Container: deprecated support for dynamically added services (BC break)
- Container: removed support for statically added createService* methods (BC break)
- Container::$meta divided to $types, $aliases, $tags & $wiring (BC break)
- Helpers::EXTENDS_KEY & OVERWRITE replaced with PREVENT_MERGING (BC break)
Finder
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- extension methods are implemented independently on ObjectMixin (BC break)
Forms
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- added Container::setMappedType() and parameter getValues($returnType) for mapping to objects
- netteForms: support for toggling by CSS selector, not only id (nette/forms#210)
- UploadControl: appends HTML attribute ‘accept’ [Closes nette/forms#172]
- SelectBox, MultiSelectBox: added getOptionAttributes() (nette/forms#189)
- BaseControl: added ability to multiple forms with different HTML ID [Closes nette/forms#188]
- DefaultFormRenderer: Add control .error class (nette/forms#209)
Changes
- Container, BaseControl: extension methods are implemented independently on ObjectMixin
- CheckboxList: removed compatibility workaround for label vs item label (BC break)
- SubmitButton::setValidationScope() accepts
?array
; replace FALSE with[]
(BC break) - BaseControl::getHtmlId() autoprefixes standalone forms with form name (BC break)
- BaseControl::getHtmlId() ensures that control is attached to the form (BC break)
- Container::addUpload() parameter $multiple is deprecated
- Form::NUMERIC differs from INTEGER, checks whether value consists only of numbers and don't cast it to integer (BC break) [Closes nette/forms#165]
- $onClick handlers are called until form is valid (BC break)
- BaseControl: labels are translated using form's translator (BC Break) (nette/forms#58) (nette/forms#141)
- netteForms: removed support for IE < 9
- ChoiceControl, MultiChoiceControl::$checkAllowedValues removed, use checkDefaultValue()
- form controls are auto-optional
Http
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- added support for SameSite cookie
- Request, HttpExtension: added sameSite protection (enabled by default)
- Session: enabled PHP option use_strict_mode
- FileUpload: added IMAGE_MIME_TYPES
- FileUpload: Added Webp content type to isImage (nette/http#132)
- added UrlImmutable
- UrlScript: added getRelativePath() [Closes nette/http#45]
- DI extensions: are using configuration Schema
- Session: do not regenerate session ID when is newly created
- Session: validates configuration option names
Changes
- UrlScript extends from UrlImmutable (BC break)
- Request: removed unused second parameter $query (BC break)
- IRequest, IResponse, Url: parameters $default are deprecated (BC break)
- some classes & members marked as final (BC break)
- HttpExtension: default value of secureCookie is auto (BC break)
- Session: default values for cookie_path, cookie_domain & cookie_secure are taken from Response
- Session::getCookieParameters() is deprecated
- Url::parseQuery() – correctly decodes spaces and dots in keys (BC break)
- Url: is not ignoring user & password (BC break) [Closes nette/http#63]
- RequestFactory: removed user & password from Url (BC break)
- Request::getReferer() returns UrlImmutable (BC break)
- Session: $started changed from static to object property
Latte
Features
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- Engine::setStrictTypes() adds declare(strict_types=1) to templates
- PhpWriter: filters are called using PHP 7 features
- added CachingIterator::__toString() (nette/latte#175)
Changes
- Compiler: removed deprecated support for inline PHP <? … ?> (BC break)
- removed deprecated stuff
{use} {status} {?...} |safeurl |nl2br shortNoEscape
- HtmlNode, MacroNode: removed $isEmpty (BC break)
- MacroTokens::fetchWord() returns NULL instead of FALSE on error (BC break)
- TokenIterator::expectNextValue() renamed to consumeValue()
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- SmtpMailer: supports TLS v1.2
Neon
- requires PHP 7.0
- uses declare(strict_types=1)
- uses PHP 7.0 scalar and return type hints
- some classes & members marked as final (BC break)
- Entity: $value is mandatory
Php Generator
New features
- added
Printer
, code from __toString moved to Printer - added
PsrPrinter
, compatible with PSR-2 and PSR-12 [Closes #30] - added
PhpNamespace::add()
[Closes #27] - added
NameAware::cloneWithName()
- added
FunctionLike::removeParameter()
&ClassType::removeMethod()
,removeProperty()
,removeConstant()
- added
ClassType::addMember()
[Closes #35] - ClassType: implemented deep clone
- ClassType: added
VISIBILITY_*
constants - PhpFile: added setStrictTypes()
Changes
PhpNamespace::add*()
– removed checking whether class already exists – to be consistent with the rest of package (BC break)- FunctionLike: removed setNamespace() (BC break)
ClassType::getNamespace()
is softly deprecated. An object can be in multiple namespaces.- ClassType, Method: added validate(), prevents classes and methods from declared both final and abstract [BC break] (#36)
- __toString converts exceptions to errors
- fine tuned generated coding style
For the details you can have a look at the diff.
Robot-loader
- removed setCacheStorage() and dependency on nette/caching (BC break)
- RobotLoader is case sensitive (BC break)
- added refresh() and non-autoloading usage
- added RobotLoader::excludeDirectory() (nette/robot-loader#9)
Routing
nette/routing was taken out nette/application
Router::match(Nette\Http\IRequest $httpRequest): ?array
Router::constructUrl(array $params, Nette\Http\UrlScript $refUrl): ?string
Safe-stream
- requires PHP 7.1
- uses PHP 7.1 features
- added PHP 7.1 scalar and return type hints
- added declare(strict_types=1);
Security
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- User::setExpiration() changed arguments (BC break with fallback)
- User: added hasAuthenticator() & hasAuthorizator(), deprecated $throw in getAuthenticator() & getAuthorizator()
- Passwords: changed from static to object class (BC break)
- Passwords: BCRYPT changed to default algorithm
- SecurityExtension: added service ‘passwords’
- some classes & members marked as final (BC break)
Schema
Handy library for validating data structures against a given Schema is here! :-)
Tokenizer
Deprecated Nette\Utils\Tokenizer
&
TokenIterator
and added new Nette\Tokenizer\Tokenizer
and Nette\Tokenizer\Stream
that represents tokens as objects
Nette\Tokenizer\Token
instead of arrays.
- requires PHP 7.1
- uses PHP 7.1 features
- added PHP 7.1 scalar and return type hints
- added declare(strict_types=1);
- added Stream::consumeToken() & consumeValue() [Closes nette/tokenizer#17]
Tracy
- requires PHP 7.1
- uses PHP 7.1 features, typehints and declare(strict_types=1)
- Dumper: lazy loading for collapsed content (10× improves the speed of loading page with large dumps)
- Bar: shows multiple AJAX requests rows
- BlueScreen & Bar: implemented table sorting
- BlueScreen: source mapping, shows original Latte template when errors occurs in compiled template
- Dumper: added cool toggle animation
- add PSR-3 adapters (nette/tracy#314)
- BlueScreen: response header are print in table
- Dumper: do not quote dumped keys nette/tracy#340
- BlueScreen:
renderToFile()
returns bool to indicate if file was written by current process (nette/tracy#325) - directory structure rearranged by modules
See videos!
- https://twitter.com/…393567707136
- https://twitter.com/…524585164800
- https://twitter.com/…458335252481
- https://twitter.com/…674191749120
For the details you can have a look at the diff.
Utils
- requires PHP 7.1
- uses declare(strict_types=1)
- uses PHP 7.1 scalar and return type hints
- Object, ObjectMixin: silently marked as deprecated
- added PhpStorm metadata for autocompletion
Changes
- 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
- Image::save() and send() throws ImageException on failure (BC break)
- Validators::assertField: first argument has type hint array
- Callback::toReflection() removed support for Nette\Reflection
- some classes & members marked as final
- ITranslator: allow multiple parameters for translated messages (nette/utils#178)
- deprecated ObjectMixin::getSuggestion()
- MemberAccessException extends from Error (BC break)
- removed StaticClassException, StaticClass throws Error
- Image::save() $file cannot be null, added output()
- DateTime: removed setTimestamp() and getTimestamp(), big int are supported in x64 PHP versions
- Strings::findPrefix accepts only string[] (BC break)
- Removed Nette\Object & ObjectMixin (BC break)
- Callback::invoke() and invokeArgs() are deprecated in favor of native invocation
- Callback: deprecated closure()
- Validators::everyIs: first argument has typehint iterable (BC break)
- Strings::normalize() a compare() dependency on Normalizer is optional
- Strings::normalize() a compare() normalize strings into UTF-8 NFC (nette/utils#150)
- Filesystem::write() accept NULL in $mode parameter (nette/utils#139)
- Milo
- Nette Core | 1283
I only remind the Nette Type Fixer tool, which helps you to fix/add typehints to classes which inherit from Nette ones.
From my personal experience it works very well, the only stumbling was on traits which overloads some Nette methods. IMHO, marginal case.
- lightteka
- Backer | 17
Suggestion, idea, don't know about your intentions with this, but… Is there a plan to publish some short information on zdrojak.cz or blog.nette.org? Something like… Nette 3 is out stay tuned for more information in few days? Link to blog is on the homepage, but blog has no information about new Nette.
- lightteka
- Backer | 17
David Grudl wrote:
A lot of articles are coming, starting next week :)
I have no doubt about it, but little announcment: “Stay tuned, next week (days – for not being too much concrete) will be great.” would be imho better then “empty” blog. It would be nice answer for that discuss under the zdrojak article, I think. Anyway thanks for that, can't wait for wider explanation what is new. Stay strong :)
- kocourPB
- Member | 47
@DavidGrudl
Hi. Did I miss something? It's 2 months since your post and I can't find any detailed article(s) about Nette 3.0. Except that one blog post and official announcement forum post. :(
I think it would be great to have some section Articles or Wrote about us on nette.org homepage with linked external blogs/articles.
- Michal Hlávka
- Member | 190
Ah, sorry it is not funny, I just read this goal
When we reach this goal, we will be able to invite co-workers to make the framework grow, improve documentation and create interesting content (videos, articles etc), that would be beneficial for the whole community. We´ll have our work translated into English.
Still, the goal has not been reached, so it makes sense there are not articles, translated work, etc.
- Mr Logic
- Member | 1
Maybe it's the other way round. Maybe Nette should drop the English support and just make it a Czech-only framework? In all honesty it's one of the best frameworks I have tried and I can see that people do their best on here to answer questions, but the English website front-page doesn't even have any reference to Nette 3 even being released. The Planette site hasn't been updated in forever and it's already been 3 months since David stated “A lot of articles are coming, starting next week :)”.
I personally just use Google translate on the Czech forum in an attempt to learn Nette. It's far from ideal but at least I am learning bits and pieces.
Sadly all frameworks have negatives. I recently had a look at the Mako Framework. It looks great but they don't even have a forum. If you're stuck, you're screwed.
The Phalcon Framework is also great, but it's a horror to install on certain Linux distributions for local development.
I reckon the best starting point for Nette is to ask the following question… “How many Czech users and developers do NOT speak/write English?”.
If 90% of the developers can speak and write in English then it would surely make sense to concentrate purely on an English language site and to update the English site to at least announce the release of Nette 3?
Last edited by Mr Logic (2019-07-15 02:46)