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\ILatteFactory
Nette\Caching\IStorage
,Nette\Caching\IBulkReader
,Nette\Caching\Storages\IJournal
Nette\Database\IConventions
,Nette\Database\ISupplementalDriver
(nowNette\Database\Driver
)Nette\Mail\IMailer
Latte\ILoader
,Latte\Runtime\IHtmlString
(nowLatte\Runtime\HtmlStringable
),Latte\Runtime\ISnipperDriver
,Latte\IMacro
Nette\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\Configurator
class has been renamed toNette\Bootstrap\Configurator
to 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\Explorer
to be consistent with the name Database Explorer - interfaces
Nette\Database\IRow
andNette\Database\IRowContainer
are 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
cookieSecure
is now by default ‘auto’- option
session.cookieSecure
is deprecated,http.cookieSecure
is used instead - cookie
nette-samesite
renamed 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::$cookieHttpOnly
is deprecatedNette\Http\FileUpload::getImageSize()
returns pair[width, height]
Neon
- Decoder: works in UTF-8 mode, throws exception on invalid input
- syntax
\xAA
is deprecated in favor of\uAAAA
Security
- interface
Nette\Security\Authenticator
differs fromIAuthenticator
by the signature of theauthenticate(string $user, string $password)
method - interface
Nette\Security\UserStorage
differs fromNette\Security\IUserStorage
- renamed the class
Nette\Security\Identity
→Nette\Security\SimpleIdentity
so that in the distant future the interfaceNette\Security\IIdentity
can 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