Migrating to Version 3.1
Minimum required PHP version is 7.2.
Nette version 3.1 means that you have these packages installed in version 3.1.*:
"require": {
"nette/application": "3.1.*",
"nette/bootstrap": "3.1.*",
"nette/forms": "3.1.*",
"nette/http": "3.1.*",
"nette/security": "3.1.*",
},
Warning: for other packages, install the latest version that Composer will allow! They may have different versioning. Try
"*" and see what version Composer installs.
All the name changes mentioned in this document mean that the original names still exist and work, of course, they are just marked as deprecated. You may encounter the IDE visually marking them as deprecated.
Interface Names
Nette has been gradually removing the I prefix from interface names for a long time, for example
Nette\Security\IAuthenticator is changed to Authenticator etc. In Nette 3.1, the prefix has disappeared
from the names of these interfaces:
Nette\Application\IRouter,Nette\Application\IResponse,Nette\Application\UI\IRenderable,Nette\Application\UI\ISignalReceiver,Nette\Application\UI\IStatePersistent,Nette\Application\UI\ITemplate,Nette\Application\UI\ITemplateFactory,Nette\Bridges\ApplicationLatte\ILatteFactoryNette\Caching\IStorage,Nette\Caching\IBulkReader,Nette\Caching\Storages\IJournalNette\Database\IConventions,Nette\Database\ISupplementalDriver(nowNette\Database\Driver)Nette\Mail\IMailerLatte\ILoader,Latte\Runtime\IHtmlString(nowLatte\Runtime\HtmlStringable),Latte\Runtime\ISnipperDriver,Latte\IMacroNette\Security\IAuthenticator*),Nette\Security\IAuthorizator,Nette\Security\IResource,Nette\Security\IRole,Nette\Security\IUserStorage*)Nette\Utils\IHtmlString(nowNette\HtmlStringable),Nette\Localization\ITranslator
*) interface with prefix is different than without prefix
Bootstrap
- the
Nette\Configuratorclass has been renamed toNette\Bootstrap\Configuratorto be consistent with the rest of the framework - added method
addStaticParameters()as alias foraddParameters() - in parameters passed by the
addStaticParameters()oraddParameters()method the%parameters%are no longer expanded
Caching
- renamed method
Nette\Caching\Cache::start()→capture()
Database
- renamed class
Nette\Database\Context→Nette\Database\Explorerto be consistent with the name Database Explorer - interfaces
Nette\Database\IRowandNette\Database\IRowContainerare marked as deprecated for uselessness - MySqlDriver driver uses subqueries
- SQL statement translator better controls where arrays can be passed
Http
- cookies are sent with the flag
sameSite: Lax cookieSecureis now by default ‚auto‘- option
session.cookieSecureis deprecated,http.cookieSecureis used instead - cookie
nette-samesiterenamed to_nss Nette\Http\Request::getFile()accepts array of keys and returns FileUpload|nullNette\Http\Session::getCookieParameters()is deprecatedNette\Http\FileUpload::getName()renamed togetUntrustedName()Nette\Http\Url: deprecatedgetBasePath(),getBaseUrl(),getRelativeUrl()(these methods are part ofUrlScript)Nette\Http\Response::$cookieHttpOnlyis deprecatedNette\Http\FileUpload::getImageSize()returns pair[width, height]
Neon
- Decoder: works in UTF-8 mode, throws exception on invalid input
- syntax
\xAAis deprecated in favor of\uAAAA
Security
- interface
Nette\Security\Authenticatordiffers fromIAuthenticatorby the signature of theauthenticate(string $user, string $password)method - interface
Nette\Security\UserStoragediffers fromNette\Security\IUserStorage - renamed the class
Nette\Security\Identity→Nette\Security\SimpleIdentityso that in the distant future the interfaceNette\Security\IIdentitycan be renamed toIdentity
Utils
Nette\Utils\Arrays::searchKey()renamed togetKeyOffset()Nette\Utils\Callback::closure()is deprecated in favor ofClosure::fromCallable()Nette\Utils\Reflection::toString()appends()after function/method nameNette\Utils\Strings::toAscii()triggers notice when ext-intl is not present