We are excited to announce the immediate availability of Phalcon 2.1 RC 1!
This version is our first LTS version and it will be supported 3 years from its final release date. Also, this will be our last release candidate before the final version of Phalcon 2.1.
Phalcon 2.1 introduces a great number of improvements, striving to make Phalcon even a better framework. Final version will be available in two weeks.
NOTE: Some of these changes will break existing Phalcon 2.x applications. Please ensure that you have tested your application sufficiently before migrating your application to 2.1 for production purposes.
Changes in Phalcon 2.1
- PHP 5.3 is no longer supported
Phalcon\Mvc\Model\Validationis now deprecated in favor ofPhalcon\Validation- The default encrypt mode in
Phalcon\Cryptis now changed toMCRYPT_MODE_CFB - Changed default hash algorithm in
Phalcon\SecuritytoCRYPT_BLOWFISH_Y - Changed constructor of
Phalcon\Mvc\Modelallowing you to pass an array of initialization data - Removed support for prefixes strategy in
Phalcon\Loader Phalcon\Mvc\Viewnow supports many views directories- An absolute path can now be used for
Mvc\View::setLayoutsDir - Fixed odd view behavior 1933 related to
setLayout()andpick() Phalcon\Diis now bound to service closures allowing usePhalcon\Dias$thisto access services within the closures- If an object is returned after firing the event
beforeServiceResolveinPhalcon\Diit overrides the default service localization process - Placeholders
:controllerand:actioninMvc\Routernow default to/([\\w0-9\\_\\-]+)instead of/([\\a-zA-Z0-9\\_\\-]+) - Modifier
#u(PCRE_UTF8) is now the default in regex based routes inMvc\Router - Return
falsefrom an action disables the view component (same as$this->view->disable()) - Return a string from an action takes it as the body of the response (same as return
$this->response->setContent('Hello world')) - Return a string from an
Mvc\Microhandler takes it as the body of the response Mvc\Router\Routenow escapes characters such as.or+to avoid unexpected behaviors- Closures used as handlers in
Mvc\Microare now bound to the$appinstance - Routes now can have an associated callback that can override the default dispatcher and view behavior
Phalcon\Mvc\Modelnow implementsJsonSerializablemaking easy serialize model instances- When destructing a
Mvc\Model\ManagerPHQL cache is cleared - Method
isSetOptioninPhalcon\Validation\ValidatorInterfacemarked as deprecated. You can now usehasOptioninstead - Added internal check
allowEmptybefore calling a validator. If it option is true and the value of empty, the validator is skipped - Added default header:
Content-Type: "application/json; charset=UTF-8"in methodPhalcon\Http\Response::setJsonContent Phalcon\Events\Eventnow implementsPhalcon\Events\EventInterfacePhalcon\Events\Event::getCancelablerenamed toPhalcon\Events\Event::isCancelable- Removed
Phalcon\Events\Manager::detachAllin favor ofPhalcon\Events\Manager::detachAll Phalcon\Mvc\Model\Criteria::getOrderis renamed toPhalcon\Mvc\Model\Criteria::getOrderBy- Added method
getOption()inPhalcon\Mvc\Model\RelationInterface - Added ability to spoof the HTTP request method
- Added
FULLTEXTindex type toPhalcon\Db\Adapter\Pdo\Mysql - Fixed the use of the annotation router with namespaced controllers
- Added
Phalcon\Acl\RoleAwareandPhalcon\Acl\ResourceAwareInterfaces. You can now pass objects toPhalcon\Acl\AdapterInterface::isAllowedasroleNameandresourceName, which will be automatically passed to the function defined inPhalcon\Acl\AdapterInterface::alloworPhalcon\Acl\AdapterInterface::denyby type Phalcon\Acl\AdapterInterface::allowandPhalcon\Acl\AdapterInterface::denyhave now a 4th argument -function, which will be called when usingPhalcon\Acl\AdapterInterface::isAllowedPhalcon\Acl\AdapterInterface::isAllowedhas now a 4th argument -parameters; You can pass arguments forfunctiondefined inPhalcon\Acl\AdapterInterface:alloworPhalcon\Acl\AdapterInterface::denyas associative array wherekeyis the argument name- Added method
getActionSuffix()inPhalcon\DispatcherInterface - CLI parameters are now handled consistently
- Added
Phalcon\Mvc\Controller\BindModelInterfaceand associated model type hint loading through dispatcher. - Added
Phalcon\Dispatcher::hasParam() Phalcon\Cli\ConsoleandPhalcon\Mvc\Applicationnow inheritPhalcon\Application.- Fixed
afterFetchevent not being sent to behaviors - Fixed issue with radio not being checked when default value is 0 11358
- Fixed issue with
Model::__setthat was bypassing setters 11286 - Fixed issue with
Model::__setthat was setting hidden attributes directly when setters are not declared 11286 - Added
Phalcon\Cli\DispatcherInterface,Phalcon\Cli\TaskInterface,Phalcon\Cli\RouterInterfaceandPhalcon\Cli\Router\RouteInterface. - Added
Phalcon\Mvc\Collection::update,Phalcon\Mvc\Collection::createandPhalcon\Mvc\Collection::createIfNotExist - Removed
__constructfrom all interfaces 11410 - Fire the
dispatch:beforeExceptionevent when there is an exception during dispatching 11458 - Added
ORoperator forPhalcon\Mvc\Model\Query\Buildermethods:betweenWhere,notBetweenWhere,inWhereandnotInWhere - Fixed bug of
destroymethod ofPhalcon\Session\Adapter\Libmemcached - Added
Phalcon\Cache\Backend\Memcache::addServersto enable pool of servers for memcache - Added
setLastModifiedmethod toPhalcon\Http\Response - Added
Phalcon\Validation\Validator\Date Mcryptis replaced with openssl inPhalcon\Crypt- Removed methods
setMode(),getMode(),getAvailableModes()inPhalcon\CryptInterface - Added
Phalcon\Assets\Manager::exists()to check if collection exists
PHP 7 support
Phalcon 2.1.x has beta PHP7 support, we expect to fix any blocking bug in the next two weeks before the final release. You can try Phalcon running on PHP7 by compiling from the 2.1.x branch using Zephir:
git clone https://github.com/phalcon/cphalcon
cd cphalcon
git checkout 2.1.x
zephir build --backend=ZendEngine3
After this, you only have to add extension=phalcon.so to your php.ini file.
New Package Infrastructure
We would like to share with you, our community, our plans for moving forward with regards to packaging and distributing Phalcon.
We have been researching many options to make the whole process easy, transparent and automated as possible. Our goal is to be able to use a continuous delivery system that will compile and package Phalcon immediately after each release. To achieve this, we chose to use the Packagecloud service to distribute Phalcon binaries.
This move will increase the availability of Phalcon in more Linux operating systems than currently available, and users will be able to use any built-in package manager of their operating system to install the framework. The available operating systems will be:
- Debian
- CentOS
- RedHat
- Amazon Linux
- Fedora
- LinuxMint
- Oracle Linux
- Raspbian
- Scientific Linux
- Ubuntu
- elementary OS
In addition to the above, automation will reduce the human interaction currently needed to create each Phalcon distribution.
For the time being, each distribution will be manually compiled by the Phalcon Team. Our goal is not to change the framework and the way it works for the community, but rather the way it is distributed. For that we will ensure that the new delivery mechanism is tested sufficiently, before we fully switch to Packagecloud and deprecate our Launchpad repository.
This move will make Phalcon available to a much wider variety of Linux based operating systems and reduce the time needed to produce those packages.
We will announce in our blog when this change will happen, so for the time being you can keep getting new versions as you have been in the past.
Update/Upgrade
Phalcon 2.1 RC1 can be installed from the 2.1.x branch, if you don’t have Zephir installed follow these instructions:
git clone https://github.com/phalcon/cphalcon
cd cphalcon/build
git checkout 2.1.x
sudo ./install
If you have Zephir installed:
git clone https://github.com/phalcon/cphalcon
cd cphalcon
git checkout 2.1.x
zephir build
Note that running the installation script will replace any version of Phalcon installed before.
Windows DLLs are available in the download page.
As always, many thanks to everyone involved in this release and thanks for choosing Phalcon!
Chat - Q&A
Support
Social Media
Videos
<3 Phalcon Team