Chapter: New features
| ^ Introduction | Migrating from a previous version » |
− Table of content
Not released yet. Still in development.
Improvements provided by the version 1.9 ¶
Warning: the documentation is not updated yet with all these changes.
Jelix 1.9 is now compatible from PHP 8.2 to PHP 8.5.
Main new features ¶
- Precompilation of templates, DAOs, forms, locales, and configuration during installation, instead of on the fly
- V2 syntax in templates: mainly,
{{ ... }}or{% ... %}tags replace{ .. }tags - Locales can be stored in separate Composer packages, and support for charsets other than UTF-8 is deprecated
- Declaration of event listeners using PHP attributes
- jDb is now based on JelixDatabase: support for schemas, generated columns, etc.
- jDao is now based on JelixDao: native support for JSON fields, custom classes for factories
- The jacl, jacldb, jpref, and jpref_admin modules are no longer provided with Jelix, but remain available in Composer packages
New features ¶
Precompilation ¶
Some files are not compiled anymore on the fly, but only during installation. It avoids launching compilers during an http request, to improve performance.
Files that are compiled during installation:
- configuration
- properties files for locales
- event listeners list
- url mapping
- forms
- template files having the
ctplextension (syntax v2 of Castor) - Daos
During the development, you can set a file watcher (into your IDE for example)
that will call php dev.php compile $FULLPATH_OF_FILE, to compile a single
file without calling the installer before each test into your browser.
Core ¶
Autoload in module.xml: allow psr fallback directories like in composer.json. You can set a directory without a namespace. This directory will be a root for namespaces that are not matched by other rules.
Templates ¶
Castor syntax v2 is now supported in template files having the ctpl extension.
These templates are compiled during the installation.
As, by default, they are considered as trusted and HTML templates, compilation of a template may fail if the format is not HTML.
Into templates, it is highly recommended to use the pragma instructions {! output-type = ... !}
to specify a content type other than HTML, and to use {! trusted = false!},
if it is not a trusted template. So compilation during installation
will be done correctly.
Locales ¶
- classes
jLocaleandjBundleare deprecated, and replaced byJelix\Locale\LocaleandJelix\Locale\Bundle. - These new classes support only UTF-8 charsets.
Jelix\Locale\LocalecalljLocaleif the default charset is not UTF-8. - Properties files are now compiled during installation to improve performance at runtime, and are used by the new classes. Deprecated classes continue to compile properties files at runtime.
- New methods
Locale::getBundle()andBundle::getAllKeys() - Locales can be in a directory outside an application, like into a Composer package.
The directory should be declared with the new API
jApp::declareLocalesDir().
Events ¶
Classes jEvent and jEventListener are deprecated and replaced by \Jelix\Event\Event
and \Jelix\Event\EventListener.
Declaration of event listener can now be done into the listener class with PHP attributes
In this case, the listener class can be any classes, not only classes inheriting
from \Jelix\Event\EventListener. However, the listener class should be still
declared into the event.xml files.
<events xmlns="http://jelix.org/ns/events/1.0">
<listener name="\JelixTests\Tests\Listener\TestAttrEventsListener"/>
</events>
use Jelix\Event\Attribute\ListenEvent;
use Jelix\Event\Attribute\ListenEventClass;
class TestAttrEventsListener
{
#[ListenEvent('TestEvent')]
function onTestEvent ($event) { }
#[ListenEventClass]
function testEventObject(EventForTest $event) { }
}
Forms ¶
- Support of
<placeholder>into<input>,<textarea>,<htmleditor>,<wikieditor>, - Forms are compiled during the installation of the application to improve performance at runtime
Database ¶
jDb is now relying on JelixDatabase.
The jDb class is still existing, but most of internal classes of jDb
are gone and replaced by classes of JelixDatabase, although many of old classes
are still existing (but can be empty) to not break typed parameters into your
classes.
It brings some new features:
- Support of schema names into table names, for some API
- Support of generated column from Postgresql (contributor: Riccardo Beltrami)
- Support of Identity column for Postgresql
- Fix lastInsertId for SQLServer
- Support of the mssql API removed. Only the connector using the sqlsrv API is available.
- Minimum version of supported databases:
- Mysql: 8.*
- PostgreSQL: 13
Plugins for jDb (aka "drivers") implementing connectors etc, are not supported anymore. They have been replaced by classes provided directly by the JelixDatabase package.
Dao ¶
jDao is now relying on JelixDao.
The jDao class is still the main class to use to load and use Dao.
Most of internal classes of jDao are gone and replaced by classes of JelixDao,
although many of old classes are still existing (but can be empty) to not break
typed parameters into your classes.
It brings some new features:
- native support of JSON fields: dao properties having the datatype
jsonare automatically encoded during insert/update, or decoded during a select. - Possibility to indicate a class from which the generated factory class will inherit.
The classname should be indicated into the
extendsattribute of<factory>. The class can be anywhere and should be autoloadable. The class must inherit fromjDaoFactoryBaseand it must be abstract.
Other changes:
- Plugins for jDao compiler (type 'daobuilder'), are not supported anymore.
- Daos files are compiled during the installation of the application to improve performance at runtime
- Classes generated from daos files have new names and are autoloaded
jSelectorDao,jSelectorDaoDbandjSelectorDaoRecordare deprecated and exists under new names.
Other new features ¶
- New methods
jFile::mergeIniFile()andjFile::mergeIniContent()
Removes ¶
- Remove support of bytecode cache other than opcache.
- Remove
jaclandjacldbmodules. There are still available into thejelix/jacl-modulepackage. But you should consider it as an archive. You should migrate to jacl2 and jacl2db. - Remove
jprefandjpref_adminmodules. There are still available into thejelix/jpref-modulepackage. But you should consider it as an archive. You should develop an alternative to these modules. - Plugins for jDb and jDao don't exist anymore.
- All error messages are now only in english. No more
jelix~db.*,jelix~daoxml.*andjelix~dao.*locales. - No more support of phpunit tests into modules.
tests/runtests.phpinto application does not work anymore.
Broken API ¶
- Catching an exception about invalid/unknown profil (jProfile) must be done
by catching
\Jelix\Profiles\Exceptioninstead ofjExceptionfrom now. jFormsCompiler,jFormsCompiler_jf_1_0,jFormsCompiler_jf_1_1have been renamed toJelix\Forms\Compiler\FormCompiler,Jelix\Forms\Compiler\/XmlCompiler10,Jelix\Forms\Compiler\/XmlCompiler11, and so, are not existing anymore.
Deprecated features ¶
- The
charsetconfiguration property is deprecated. You should keep the default value to UTF-8. If not, convert your locales and other data to UTF-8 as the support of other charset will be gone in the next major version. \Jelix\Core\Profilesmust be used instead ofjProfiles. Same API, but it is now relying on the JelixProfiles library.jProfilesis deprecated as well as methodsstoreInPool,getFromPool,getOrStoreInPool. UsestoreConnectorInPool,getConnectorFromPool,getConnectorFromCallbackinstead.- If there are some plugins for jProfiles, they must inherit from
\Jelix\Profiles\ReaderPlugininstead ofjProfilesCompilerPlugin, or they must implement at least of the new interface\Jelix\Profiles\ProfilePluginInterface.jProfilesCompilerPluginis deprecated. jClassBindingjelix_read_ini- jDao: method type
xml. A PHP class should be used instead, that is declared into theextendsattribute of<factory>. csshttp request object is deprecated.- constant
JELIX_SCRIPTS_PATHis now deprecated, as it becomes useless. - Functions declared into the namespace
Jelix\Utilitiesare deprecated. Use them from the namespaceJelix\Core\Utilities. - Interface
\jelix\Core\ConfigCompilerPluginInterfaceis deprecated. use\Jelix\Core\Config\CompilerPluginInterfaceinstead. - selector classes:
jSelectorAppCfg,jSelectorCfg,jSelectorDebugAction,jSelectorLib,jSelectorTmp,jSelectorVar - replace
jSelectorModulebyJelix\Core\Selector\ModuleSelector - replace
jISelectorbyJelix\Core\Selector\SelectorInterface - replace
jExceptionSelectorbyJelix\Core\Selector\Exception jelix_scan_module_sel- classes
jLocaleandjBundleare deprecated, and replaced byJelix\Locale\LocaleandJelix\Locale\Bundle. - The method
jConfigCompiler::findServerName()has been moved tojServer jSelectorForm
About jDb:
jDbConnectionandjDbPDOConnectionare deprecated and replaced by objects implementingJelix\Database\ConnectionInterfaceandJelix\Database\ConnectionConstInterface- constants
FETCH_*,ATTR_*andCURSOR_*are moved toConnectionConstInterface
- constants
jDbResultSetandjDbPDOResultSetare deprecated and replaced by objects implementingJelix\Database\ResultSetInterfacejDbParametersis deprecated and replaced by\Jelix\Database\AccessParameters- public methods are the same, however
getParameters()is deprecated,getNormalizedParameters()should be used instead
- public methods are the same, however
jDbToolsis deprecated and replaced by objects implementingJelix\Database\Schema\SqlToolsInterface- methods
getFieldList()andgetTableList()are deprecated - constants
IBD_*are moved toSqlToolsInterface
- methods
jDbSchemais deprecated and replaced by objects implementingJelix\Database\Schema\SchemaInterfacejDbIndex,jDbConstraint,jDbUniqueKey,jDbPrimaryKey,jDbReference,jDbColumn,jDbTableare replaced by some classes of theJelix\Database\Schema\namespace.jDbUtilsandjDbUtils::getTools()is deprecated and is replaced by\Jelix\Database\Connection::getTools()jDbWidgetis deprecated and replaced byJelix\Database\HelpersjDaoDbMapper::createTableFromDao()returns an object\Jelix\Database\Schema\TableInterfaceinstead ofjTable
About jDao:
jDaoFactoryBaseis replaced by objects implementingJelix\Dao\DaoFactoryInterfacejDaoRecordBaseis replaced by objects implementingJelix\Dao\DaoRecordInterface- methods
getDbProfileandsetDbProfiledon't exist onJelix\Dao\DaoRecordInterface. - method
getSelector()is deprecated,getDaoName()should be used instead.
- methods
jDaoConditionsandjDaoConditionare deprecated and replaced by\Jelix\Dao\DaoConditionsand\Jelix\Dao\DaoCondition.jDaoXmlExceptionis deprecated and not used anymore. The parser generatesJelix\Dao\Parser\ParserExceptioninstead.jDaoGeneratorandjDaoParserare removedjDaoMethodis replaced byJelix\Dao\Parser\DaoMethodjDaoPropertyis replaced byJelix\Dao\Parser\DaoPropertyjDaoDbMapperis replaced byJelix\Dao\DbMapperjDaoSelector*classes are replaced byJelix\Dao\DaoSelector*classes
Internal changes ¶
- constant
JELIX_SCRIPTS_PATH: its value is now<vendor path>/lib/JelixFramework/DevHelper/.
Contributors to Jelix 1.9 ¶
- Laurent Jouanneau
- Raphael Martin
- Riccardo Beltrami

