The Phalcon Team wishes all of our friends, contributors, developers and users of the framework a Merry Christmas!. We hope that the new year will bring health and happiness to you and your loved ones!
After months of work on v4 (most of them long nights), we are happy to announce the release of Phalcon v4.0.0 Alpha 1 as a small gift to our friends and community for this joyous day. First and foremost:
A huge thank you to all of our contributors and the community!!
Second and equally important:
This release IS NOT BACKWARDS COMPATIBLE - YOU WILL NEED TO REFACTOR YOUR EXISTING APPLICATIONS
YOU NEED TO LOAD THE PSR EXTENSION BEFORE THE PHALCON ONE [REPO]
The release tag can be found here: v4.0.0-alpha1.
We still have a lot of work ahead of us until v4 is marked as stable. The project page that we keep the status of the work we have done and need to do can be found here. As you can see there are a few bugs that we need to address but also a couple of big items that require significant refactoring.
Some highlights of this version include:
- Minimum supported version for PHP is 7.2
- Much tighter interfaces and typed parameters/return types
- Corrected a lot of inconsistencies in interfaces and implementation classes
- PSR-3 : Logger has been rewritten from the ground up
- PSR-11 : Container implementation (will be rewritten in a future version)
- PSR-16 : Todo for now. It will be available in the next version
- More code coverage, setup local testing environment and more.
Changelog
THIS RELEASE IS NOT BACKWARDS COMPATIBLE
Added
- Added CODE_OF_CONDUCT for the project
- Added
Phalcon\Db\Adapter\Pdo\Postgresql::describeReferencesto implement custom Postgresql rules 438 - Added
Phalcon\Mvc\Router\RouteInterface::convertso that callingPhalcon\Mvc\Router\Group::addwill return an instance that hasconvertmethod #13380 - Added
Phalcon\Mvc\ModelInterface::getModelsMetaData#13070 - Added
Phalcon\Validation\Validator\Ip, class used to validate ip address fields. It allows to validate a field selecting IPv4 or IPv6, allowing private or reserved ranges and empty values if necessary. #13574 - Added
Phalcon\Messages\MessageInterface,Phalcon\Messages\Message,Phalcon\Messages\ExceptionandPhalcon\Messages\Messagesto handle all messages for the application (model/validation) #13114 - Added
getHandlerSuffix(),setHandlerSuffix()in Dispatcher,getTaskSuffix(),setTaskSuffix()in the CLI Dispatcher #13468 - Added ability to set a custom template for the Flash Messenger. #13445
- Added
forUpdatein the Sqlite dialect to override the method from the base dialect. #13539 - Added
TYPE_ENUMin the Mysql adapter. #11368 - Added more column types for the Mysql adapter. The adapter supports
TYPE_BIGINTEGER,TYPE_BIT,TYPE_BLOB,TYPE_BOOLEAN,TYPE_CHAR,TYPE_DATE,TYPE_DATETIME,TYPE_DECIMAL,TYPE_DOUBLE,TYPE_ENUM,TYPE_FLOAT,TYPE_INTEGER,TYPE_JSON,TYPE_JSONB,TYPE_LONGBLOB,TYPE_LONGTEXT,TYPE_MEDIUMBLOB,TYPE_MEDIUMINTEGER,TYPE_MEDIUMTEXT,TYPE_SMALLINTEGER,TYPE_TEXT,TYPE_TIME,TYPE_TIMESTAMP,TYPE_TINYBLOB,TYPE_TINYINTEGER,TYPE_TINYTEXT,TYPE_VARCHAR#13151, #12223, #524, #13225 @zGaron, #12523 @Studentsov, #12471 @ruudboon - Added
Phalcon\Acl\Adapter\Memory::addRolesupport multiple inherited #13557 - Added
Phalcon\Tag::renderTitle()that renders the title enclosed in<title>tags. #13547 - Added
hasHeader()method toPhalcon\Http\Responseto provide the ability to check if a header exists. #12189 - Added global setting
orm.case_insensitive_column_mapto attempt to find value in the column map case-insensitively. Can be also enabled by settingcaseInsensitiveColumnMapkey in\Phalcon\Mvc\Model::setup(). #11802 - Added the ability to use FrontendInterface to serialize Model and ResultSet - Inject a
serializerobject which implementsFrontendInterfacein DI to use it. #12808 - Added
Phalcon\Mvc\Model\Query\BuilderInterface::offset#13599 - Added
Phalcon\Http\Response\Cookies::getCookies#13591 - Added
Phalcon\Mvc\Model::isRelationshipLoadedto check if relationship is loaded #12772 - Added an easy way to work with Phalcon and run the tests locally, using nanobox.io #13578
- Added response handler to
Phalcon\Mvc\Micro,Phalcon\Mvc\Micro::setResponseHandler, to allow use of a custom response handler. #12452 - Added two new events
response::beforeSendHeadersandresponse::afterSendHeaderstoPhalcon\Http\Response#10689 - Added a retainer for the current token to be used during the checkings, so when
Phalcon\Security::getTokenis called the token used for checkings don’t change. #12392 - Added
Phalcon\Html\Tag, a component that creates HTML elements. It will replacePhalcon\Tagin a future version. This component does not use static method calls. #12392 - Added
Phalcon\Paginator\RepositoryInterfacefor repository the current state ofpaginatorand also optional sets the aliases for properties repository #10985, #10957 - Added bind support to
Phalcon\Mvc\Model\Query\Builder. The Query Builder has the same methods asPhalcon\Mvc\Model\Query;getBindParams,setBindParams,getBindTypesandsetBindTypes. #13368 - Added
Phalcon\Html\Breadcrumbs, a component that creates HTML code for breadcrumbs. #13680 - Added more methods to interfaces.
Phalcon\Cli\Router\RouteInterface-delimiter,getDelimiterPhalcon\Cli\DispatcherInterface-setOptions,getOptionsPhalcon\Db\AdapterInterface-fetchColumn,insertAsDict,updateAsDictPhalcon\Db\DialectInterface-registerCustomFunction,getCustomFunctions,getSqlExpressionPhalcon\Di\ServiceInterface-getParameter,isResolvedPhalcon\Events\ManagerInterface-hasListenersPhalcon\Mvc\Model\Query\BuilderInterface-distinct,getDistinct,forUpdate,offset,getOffsetPhalcon\Mvc\Model\Transaction\ManagerInterface-setDbService,getDbService,setRollbackPendent,getRollbackPendentPhalcon\Mvc\Model\CriteriaInterface-distinct,leftJoin,innerJoin,rightJoin,groupBy,having,cache,getColumns,getGroupBy,getHaving,Phalcon\Mvc\Model\ManagerInterface-isVisibleModelProperty,keepSnapshots,isKeepingSnapshots,useDynamicUpdate,isUsingDynamicUpdate,addHasManyToMany,existsHasManyToMany,getRelationRecords,getHasManyToMany,registerNamespaceAlias,getNamespaceAliasPhalcon\Mvc\Model\MessageInterface-setModel,getModel,setCode,getCodePhalcon\Mvc\Model\QueryInterface-getSingleResult,setBindParams,getBindParams,setBindTypes,setSharedLock,getBindTypes,getSqlPhalcon\Mvc\Model\RelationInterface-getParamsPhalcon\Mvc\Model\ResultsetInterface-setHydrateMode,getHydrateMode,getMessages,update,delete,filterPhalcon\Mvc\ModelInterface-getModelsMetaDataPhalcon\Session\AdapterInterface-setId,statusPhalcon\Validation\MessageInteraface-getCode,setCodePhalcon\CryptInterface-setPaddingPhalcon\Mvc\RouterInterface-attach#12676
- Added
Phalcon\Container, a proxy container class to thePhalcon\DIimplementing PSR-11 #12295 - Added
Phalcon\Acl\Adapter\Memory::getActiveKey,Phalcon\Acl\Adapter\Memory::activeFunctionCustomArgumentsCountandPhalcon\Acl\Adapter\Memory::getActiveFunctionto get latest key, number of custom arguments, and function used to acquire access #12547
Changed
- Now Phalcon requires the PSR PHP extension to be installed and enabled
- By configuring
prefixandstatsKeythePhalcon\Cache\Backend\Redis::queryKeysno longer returns prefixed keys, now it returns original keys without prefix. #13656 - The
Phalcon\Mvc\Application,Phalcon\Mvc\MicroandPhalcon\Mvc\Routernow must have a URI to process #12380 - Response headers and cookies are no longer prematurely sent #12378
- You can no longer assign data to models whilst saving them #12317
- The
Phalcon\Mvc\Model\Manager::loadno longer reuses already initialized models #12317 - Changed
Phalcon\Db\Dialect\Postgresql::describeReferencesto generate correct SQL, added “on update” and “on delete” constraints 438 - Changed catch
ExceptiontoThrowable#12288 - Changed
Phalcon\Mvc\Model\Query\Builder::addFromto remove third parameter$with#13109 Phalcon\Forms\Form::clearwill no longer callPhalcon\Forms\Element::clear, instead it will clear/set default value itself, andPhalcon\Forms\Element::clearwill now callPhalcon\Forms\Form::clearif it’s assigned to the form, otherwise it will just clear itself. #13500Phalcon\Forms\Form::getValuewill now also try to get the value by callingTag::getValueor element’sgetDefaultmethod before returningnull, andPhalcon\Forms\Element::getValuecallsTag::getDefaultonly if it’s not added to the form. #13500- Changed
Phalcon\Mvc\Modelto use thePhalcon\Messages\Messageobject for its messages #13114 - Changed
Phalcon\Validation\*to use thePhalcon\Messages\Messageobject for its messages #13114 - Collections now use the Validation component #12376
- Made the
specialKey(_PHCR) optional for thePhalcon\Cache\Backend\Redisadapter #10905, #11608 - Refactored
Phalcon\Db\Adapter\Pdo::queryto use PDO’s prepare and execute.Phalcon\Db\Adapter::fetchAllto use PDO’s fetchAll #13515 - Fixed
\Phalcon\Http\Response::setFileToSendfilename last much _ #13496 - Changed
Phalcon\Tag::getTitle. It returns only the text. It acceptsprepend,appendbooleans to prepend or append the relevant text to the title. #13547 - Changed
Phalcon\Di\Serviceconstructor to no longer takes the name of the service. #13590 - Changed
Phalon\Tag::textAreato usehtmlspecialcharsto prevent XSS injection. #12428 - Changed
Phalon\Cache\Backend\*::getto use only positive numbers forlifetime11759 - Changed
Phalcon\Loggerto comply with PSR-3. The component has been rewritten to use adapters that allow logging to different areas. The #13438 - Renamed
Phalcon\Assets\Resourcenamespace toPhalcon\Assets\Asset#12082 - Renamed
Phalcon\Assets\ResourcetoPhalcon\Assets\Asset#12082 - Renamed
Phalcon\Assets\ResourceInterfacetoPhalcon\Assets\AssetInterface#12082 - Renamed
Phalcon\Assets\Manager::addResourcetoPhalcon\Assets\Manager::addAsset#12082 - Renamed
Phalcon\Assets\Manager::addResourceByTypetoPhalcon\Assets\Manager::addAssetByType#12082 - Renamed
Phalcon\Assets\Manager::collectionResourcesByTypetoPhalcon\Assets\Manager::collectionAssetsByType#12082 - Changed
paginatein the place ofgetPaginate. Addedpreviousin the place ofbefore. #13492 - Scope SQL Column Aliases (on nesting level), in
Phalcon\Mvc\Model\Query, to prevent overwrite root query’s_sqlColumnAliasesby sub-queries. #13006, #12548 and #1731 - CLI parameters now work like MVC parameters #12375
- Changed
Phalcon\Db\Dialect\Postgresql::addPrimaryKeyto make primary key constraints names unique by prefixing them with the table name. #12629 - Fixed
Phalcon\Mvc\Model\Query::_prepareSelectoverwriting columns with the same alias #13552 - Changed
Phalcon\Http\RequestInterfaceto align withPhalcon\Http\Request#13061 - Renamed
Phalcon\Acl\ResourcetoPhalcon\Acl\Subject#13639 - Renamed
Phalcon\Acl\ResourceInterfacetoPhalcon\Acl\SubjectInterface#13639 - Renamed
Phalcon\Acl\ResourceAwaretoPhalcon\Acl\SubjectAware#13639 - Renamed
Phalcon\Acl\RoletoPhalcon\Acl\Operation#13639 - Renamed
Phalcon\Acl\RoleInterfacetoPhalcon\Acl\OperationInterface#13639 - Renamed
Phalcon\Acl\RoleAwaretoPhalcon\Acl\OperationAware#13639 - Renamed
Phalcon\Acl\AdapterInterface::addRoletoPhalcon\Acl\AdapterInterface::addOperation#13639 - Renamed
Phalcon\Acl\AdapterInterface::isRoletoPhalcon\Acl\AdapterInterface::isOperation#13639 - Renamed
Phalcon\Acl\AdapterInterface::isResourcetoPhalcon\Acl\AdapterInterface::isSubject#13639 - Renamed
Phalcon\Acl\AdapterInterface::addResourcetoPhalcon\Acl\AdapterInterface::addSubject#13639 - Renamed
Phalcon\Acl\AdapterInterface::addResourceAccesstoPhalcon\Acl\AdapterInterface::addSubjectAccess#13639 - Renamed
Phalcon\Acl\AdapterInterface::dropResourceAccesstoPhalcon\Acl\AdapterInterface::dropSubjectAccess#13639 - Renamed
Phalcon\Acl\AdapterInterface::getActiveRoletoPhalcon\Acl\AdapterInterface::getActiveOperation#13639 - Renamed
Phalcon\Acl\AdapterInterface::getActiveResourcetoPhalcon\Acl\AdapterInterface::getActiveSubject#13639 - Renamed
Phalcon\Acl\AdapterInterface::getRolesstoPhalcon\Acl\AdapterInterface::getOperations#13639 - Renamed
Phalcon\Acl\AdapterInterface::getResourcestoPhalcon\Acl\AdapterInterface::getSubjects#13639 - Renamed
Phalcon\Acl\Adapter::getActiveRoletoPhalcon\Acl\AdapterInterface::getActiveOperation#13639 - Renamed
Phalcon\Acl\Adapter::getActiveResourcetoPhalcon\Acl\AdapterInterface::getActiveSubject#13639 - Renamed
Phalcon\Acl\Adapter\Memory::addRoletoPhalcon\Acl\Adapter\Memory::addOperation#13639 - Renamed
Phalcon\Acl\Adapter\Memory::isRoletoPhalcon\Acl\Adapter\Memory::isOperation#13639 - Renamed
Phalcon\Acl\Adapter\Memory::isResourcetoPhalcon\Acl\Adapter\Memory::isSubject#13639 - Renamed
Phalcon\Acl\Adapter\Memory::addResourcetoPhalcon\Acl\Adapter\Memory::addSubject#13639 - Renamed
Phalcon\Acl\Adapter\Memory::addResourceAccesstoPhalcon\Acl\Adapter\Memory::addSubjectAccess#13639 - Renamed
Phalcon\Acl\Adapter\Memory::dropResourceAccesstoPhalcon\Acl\Adapter\Memory::dropSubjectAccess#13639 - Renamed
Phalcon\Acl\Adapter\Memory::getRolesstoPhalcon\Acl\Adapter\Memory::getOperations#13639 - Renamed
Phalcon\Acl\Adapter\Memory::getResourcestoPhalcon\Acl\Adapter\Memory::getSubjects#13639 - Changed
Phalcon\Http\Response::setHeadersnow merges the headers with any pre-existing ones in the internal collection #12836 - Changed
Phalcon\DI\FactoryDefaultto not load by default - Changed the
Phalcon\Sessionnamespace by refactoring the component.Phalcon\Session\Manageris now the single component offering session manipulation by using adapters. Each adapter implements PHP’sSessionHandlerInterface. Available adapters arePhalcon\Session\Files,Phalcon\Session\Libmemcached,Phalcon\Session\NoopandPhalcon\Session\Redis. #12921, #11341, #13535 - Fixed
Phalcon\Mvc\Modelsmagic method (setter) is fixed for arrays #13661 - Fixed
Phalcon\Mvc\Model::skipAttributesandPhalcon\Mvc\Model::allowEmptyColumnsallowEmptyStrings & skipAttributes repsect the column mapping. #12975, #13477
Removed
- PHP < 7.2 no longer supported
- Removed
xcachesupport from adapters #13628 - Removed
apcsupport from adapters (useapcu) #13628 - Removed
memcachesupport from adapters (uselibmemcached) #13628 - Removed deprecated
Phalcon\Annotations\Adapter\Apc - Removed deprecated
Phalcon\Annotations\Adapter\Xcache - Removed deprecated
Phalcon\Cache\Backend\Apc - Removed deprecated
Phalcon\Cache\Backend\Memcache - Removed deprecated
Phalcon\Cache\Backend\Xcache - Removed deprecated
Phalcon\Cli\Console::addModules - Removed deprecated
Phalcon\Debug::getMajorVersion - Removed deprecated
Phalcon\Mvc\Model\Criteria::addWhere - Removed deprecated
Phalcon\Mvc\Model\Criteria::order - Removed deprecated
Phalcon\Mvc\Model\Metadata\Apc - Removed deprecated
Phalcon\Mvc\Model\Metadata\Memcache - Removed deprecated
Phalcon\Mvc\Model\Metadata\Xcache - Removed deprecated
Phalcon\Mvc\View::getParams - Removed deprecated
Phalcon\Mvc\ViewInterface::getParams - Removed deprecated
Phalcon\Paginator\Adapter\Model::getPaginate - Removed deprecated
Phalcon\Paginator\Adapter\Model - $before - Removed deprecated
Phalcon\Paginator\Adapter\Model - $total_pages - Removed deprecated
Phalcon\Paginator\Adapter\NativeArray::getPaginate - Removed deprecated
Phalcon\Paginator\Adapter\NativeArray - $before - Removed deprecated
Phalcon\Paginator\Adapter\NativeArray - $total_pages - Removed deprecated
Phalcon\Paginator\Adapter\QueryBuilder::getPaginate - Removed deprecated
Phalcon\Paginator\Adapter\QueryBuilder - $before - Removed deprecated
Phalcon\Paginator\Adapter\QueryBuilder - $total_pages - Removed deprecated
Phalcon\Security::hasLibreSsl - Removed deprecated
Phalcon\Security::getSslVersionNumber - Removed deprecated
Phalcon\Validation\Validator::isSetOption - Removed
Phalcon\Cli\Console::addModulesin favor ofPhalcon\Cli\Console::registerModules - Removed
Phalcon\Debug::getMajorVersiondue to the fact that we never use this method - Removed
Phalcon\Dispatcher::setModelBindingin favor ofPhalcon\Dispatcher::setModelBinder - Removed
Phalcon\Http\RequestInterface::isSecureRequestin favor ofPhalcon\Http\RequestInterface::isSecure - Removed
Phalcon\Http\RequestInterface::isSoapRequestedin favor ofPhalcon\Http\Request::isSoap - Removed
Phalcon\Logger\Multiple - Removed
Phalcon\Mvc\Collection::validationHasFailed - Removed
Phalcon\Mvc\Model\Criteria::orderin favor ofPhalcon\Mvc\Model\Criteria::orderBy - Removed
Phalcon\Mvc\Model\Validator\*in favor ofPhalcon\Validation\Validator\* - Removed
Phalcon\Mvc\Micro\Lazyloader::__callin favor ofPhalcon\Mvc\Micro\Lazyloader::callMethod - Removed
Phalcon\Model::reset#12317 - Removed
Phalcon\Validation\MessageandPhalcon\Mvc\Model\Messagein favor ofPhalcon\Messages\Message - Removed
Phalcon\Validation\MessageInterfaceandPhalcon\Mvc\Model\MessageInterfacein favor ofPhalcon\Messages\MessageInterface - Removed
Phalcon\Validation\MessageandPhalcon\Mvc\Model\Messagein favor ofPhalcon\Messages\Message - Removed
Phalcon\Validation\Message\Groupin favor ofPhalcon\Messages\Messages - Removed calling
Phalcon\Mvc\Collection::validatewith object of typePhalcon\Mvc\Model\ValidatorInterface
Installation/Upgrade
The packages in packagecloud.io are being updated (at the time of this post) and will be ready soon. You can also download the zip file from our release page here.
You can also clone the repository and checkout the tag, and then run
zephir fullclean
zephir build
to install the new extension. For more information you can check the [installation guide)(https://docs.phalcon.io/en/3.4/installation).
Thank you
Once again a huge thank you to all of our contributors! You guys have helped us a lot. You can help us even more by installing this version and testing it. If you find bugs, please report them in our [Github Issues] (https://github.com/phalcon/cphalcon/issues) page. Alternatively you can always join us in our Discord server or our Forum.
Chat - Q&A
Support
Social Media
Videos
<3 Phalcon Team