Blog and News

Phalcon 2 (beta 3) released

Today we’re very excited to announce the release of the third beta (and possibly last one) of Phalcon 2!

Phalcon 2 is almost fully functional and stable as Phalcon 1.x, virtually all tests in 1.x are now passing 2.0. If you haven’t tried Phalcon 2 out, it’s time to give it a shot!

Preparing your migration to Phalcon 2

Interfaces and type checkings

Thanks to Zephir, Phalcon 2 performs a greater number of type and class checks, and as a result this make the whole framework more stable and consistent. If a wrong type or class is passed to a method you’ll see the relevant exception with a verbose message. If you have created user adapters or extended framework components and they do not implement the necessary interfaces and/or types you may need to fix them.

Catchable fatal error: Argument 2 passed to Phalcon\Mvc\Model\Query::__construct() must implement 
interface Phalcon\DiInterface, instance of stdClass given in /home/scott/test.php on line 17

Better debug information

Zephir provides the exact place where an exception was thrown and it will provide more information as to where the error occurred.

Exception: The static method 'someMethod' doesn't exist on model 'Robots'
File=phalcon/mvc/model.zep Line=4042
#0 /home/scott/test.php(64): Phalcon\Mvc\Model::__callStatic('someMethod', Array)
#1 /home/scott/test.php(64): Robots::someMethod()
#2 {main}

This could help you to find solutions for your problems by just looking at the framework source.

Error Handling

Phalcon 2 provides better facilities to handle exceptions, for instance, in micro applications you can use the new error handler which will allow you to do something like this:

use Phalcon\Http\Response;
use Phalcon\Mvc\Micro;

$app = new Micro();

$app->map('/say/{name}', function ($name) {
    throw new \Exception("An exception has occurred");

$app->error(function($e) {
	return new Response('Internal error');		

These facilities were easily implemented thanks to the low-level exception system provided by Zephir.

Performance Improvements

Zephir/Phalcon 2 takes advantage of the improved way to return values in PHP 5.6. This optimization greatly reduces the number of unecessesary copies improving the performance.

Phalcon 2 new look

Our community have contributed 4 amazing proposals for the new design in the Phalcon 2 era. Contribute by voting your favorite design here.

Want to contribute?

From the beginning, Phalcon has been a different framework than any other framework out there, providing developers with many components and functionality in a single PHP extension. If you want to contribute in Phalcon 2, being a part of something unique and amazing, the simplest way is to look through the issue tracker for issues, bugs or features to implement. Help us to make Phalcon the greatest framework for PHP ever! Your contributions are very valuable.


An important work has been done migrating and simplifying tests for Phalcon 2 into a single test-suite powered by CodeCeption. See the migrated tests here.

Help with Testing

This version can be installed from the 2.0.0 branch, if you don’t have Zephir installed follow these instructions:

git clone
git checkout 2.0.0
cd ext
sudo ./install

If you have Zephir installed:

git clone
git checkout 2.0.0
zephir build

We hope that you will enjoy these improvements and additions. We invite you to share your thoughts and questions about this version on Phosphorum.


Phalcon 1.3.3 released

This version is maintenance release of the Phalcon 1.3.x branch and it has a contributions from our community and fixes to the framework. We thank everyone that has worked on this release, especially with their contributions both to 1.3.3 and our work in progress 2.0.0.

Many thanks to everyone that have contributed either on Github or through discussion in our forum to this version.

From now, we encourage all the community to dedicate some time to test and improve Phalcon 2 our next big release.

Thank you!

Phalcon 2 beta 2 available

It’s been a while since we last communicated with our community. Rest assured our resolve and determination towards the project remains the same :)

We’re in the process putting the final touches on the second major release of Phalcon in its two years of life. Phalcon 2 is powered by Zephir a brand new high-level language that makes the development more enjoyable and easier.

Phalcon 2 now implements most of the functionality that Phalcon 1.x offers and it’s now passing an important number of tests in Travis. Yay!

Phalcon 2 new look

We’re looking for a enthusiast graphic designer/company who want to contribute a new look for Phalcon when releasing Phalcon 2. Check this forum thread for more information.

Want to contribute?

The simplest way is to look through the issue tracker for issues or features to implement. Also fixing the necessary code to make some unit-tests pass on Phalcon 2 would help a lot.


With 2.0 we are moving our whole test suite to Codeception. Initial work has been done and we will start pushing the base structure upstream while “moving” existing tests to the new Codeception powered suite. We will need a lot of help to get that task completed so if you want to contribute, keep an eye out in our forum in the very near future for the relevant announcement.

Help with Testing

This version can be installed from the 2.0.0 branch, if you don’t have Zephir installed follow these instructions:

git clone
git checkout 2.0.0
cd ext
sudo ./install

If you have Zephir installed:

git clone
git checkout 2.0.0
zephir build

We rely on the feedback from everyone in the community to flush out bugs and upgrade issues ahead of a big release like this. So please give Phalcon 2 a try on your app, and if you’re starting a new app today, you should also probably try the beta2 for that, if you’re just the least bit savvy with Phalcon.

BuiltWith Phalcon

Today we are launching a new site that would help us spread the word about Phalcon and show where Phalcon is used, whether this is production applications, hobby projects or tutorials.


Taking the example from our friends at AngularJS we have cloned their repository and we have Phalcon-ized it. Special thanks to the AngularJS team as well as Ole Aass (website) who is leading the project.

The new site has a very easy interface that users can navigate to and even search for projects with tags. 

You can add your own project by simply cloning our repository and adding your project as well as a logo and screenshots and then issue a pull request for it to appear in the live site.

Looking forward to seeing your projects listed up there!

<3 The Phalcon Team

Phalcon 1.3.2 Released

We are today releasing the much awaited 1.3.2 version. 

This version has a ton of contributions from our community and fixes to the framework. We thank everyone that has worked on this release, especially with their contributions both to 1.3.2 and our work in progress 2.0.0.

Many thanks to dreamsxin, mruz, kjdev, Cinderella-Man, andreadelfino, kfll, brandonlamb, zacek, joni, wandersonwhcr, kevinhatry, alkana and many others that have contributed either on Github or through discussion in our forum.

The changelog can be found here.

We also have a number of pull requests that have not made it to 1.3.2 but will be included to 1.3.3. We need to make sure that the fix or feature that each pull request offers are present both in 1.3.3 but also in 2.0.0

A big thank you once again to our community! You guys are awesome!

<3 Phalcon Team

Phalcon 2 (beta 1) released!

Eight months ago we announced the creation of a new high-level compiled language called Zephir which we used to completely rewrite Phalcon 2.0.

Zephir’s purpose is to offer a new and easier syntax of writing PHP extensions, translating its PHP/JS inspired syntax to C instructions and thus allowing more and more developers to be involved with the project. In addition, it offers the ability to create new PHP extensions without the need to know C or any of the PHP internals.

For us and thanks to Zephir, the development of Phalcon is now more enjoyable. We have to deal less and less with low-level details and our base code is more readable for anyone who wants to understand, contribute and improve Phalcon.

During these we have been implemented several interesting features in Zephir, that have enriched the quality of Phalcon and have made the development more robust:

The result of all this hard work is now available for all to use. Today, we are excited to announce the release of Phalcon 2 beta 1!

To showcase our trust in our work, the following Phalcon powered software uses Phalcon 2.0:

Official WebSite


The official Phalcon website was one of the first Phalcon applications that we have focused on, to make sure that the Phalcon 2.0 code base is compatible with it and thus compatible with Phalcon 1.x.

Today, it runs entirely on Phalcon 2.0. If you have visited our site in the last few days, you have contributed in testing Phalcon 2.0.



INVO was the first application we launched several months ago to show how an application can be created using Phalcon. It’s also now fully compatible with Phalcon 2.0.



Phosphorum is the software that powers our discussion forum. Everyone that has used Phosphorum in the last couple of weeks has been using an application that is powered by Phalcon 2.0 in production!

Is Phalcon 2/Zephir ready?

All the functionality available in Phalcon 1.x has not yet been completely migrated to Phalcon 2.0. For example, only support for MySQL is available with regards to database adapters at the moment. Other adapters are missing but they will be implemented in the very near future.

There are for sure some bugs and issues to resolve and we need to enhance the test suite to cover more of the code base. However we are confident that with your help we will achieve a stable version very soon.

Regarding Zephir, while the progress made is quite significant, there is much work to do as with any language:

  • Increase stability
  • Improve documentation
  • Increase debuggability
  • Improve performance in certain scenarios, etc.

With the contributions of the community and the use case available through Phalcon 2.0, Zephir will undoubtedly evolve even more.

Help with Testing

This version can be installed from the 2.0.0 branch:

git clone
git checkout 2.0.0
cd ext
sudo ./install

We welcome your comments regarding this new release. If you discover any bugs, please (if possible) create a failing test and submit a pull request, alongside with an issue on Github.

Want to contribute?

The simplest way is to look through the issue tracker for issues or features to implement. Also fixing the necessary code to make some unit-tests pass on Phalcon 2.0 would help a lot.

Next Steps

While with the help of Zephir the maintenance of Phalcon 2.0’s code should be much easier now, we know that it could be even better. One disadvantage of the compiled languages in a large code base, such as Phalcon’s, is that compilation takes away several seconds and introduces undesired pauses in the development.

That is why we recently started developing something called Zephir “Runtime”. With all the experience we have acquired over the last few years and following the same philosophy we used on the code generation in the Zephir AOT, started to implement a JIT compiler for Zephir.

This JIT compiler will aid in making development and testing with Zephir much faster and in the long run become an alternative to the Zephir compiler itself, achieving similar or better performance depending on the scenario.

Zephir Runtime is still in its infancy and right now only supports a minimal subset of the Zephir language.

The following video shows how it works:

As you can see, there is no need to invoke the Zephir compiler so as to recompile your extension after changes were made. Just by refreshing the page, the Zephir code is compiled on-the-fly using LLVM as backend.

Zephir Runtime is still in the earliest stages and we’re hopeful that by announcing it early in its lifecycle and open-sourcing the code, we can collaborate with the community throughout its development.

We hope you all have enjoyed these great news, in the next few weeks we will be announcing new betas and more news.

Thank you!

<3 The Phalcon Team

Phalcon Community Hangout

Yesterday (2014-04-05) we had our first Phalcon community hangout. The main purpose of the hangout was to meet the community, discuss about what Phalcon is and what our future steps are, and hear news, concerns, success stories from the community itself.

We are excited to announce that the first Phalcon community hangout was a great success!

We had an awesome turnout from all around the world, with members of the community filling the hangout (10 concurrent users) and more viewing online, asking questions and interacting with the team.

We talked about where we are, where we came from and what the future steps are with Zephir and Phalcon 2.0. Contributions, bugs and NFRs were also topics in our discussion, as well as who are team and how Phalcon is funded.

More hangouts will be scheduled in the near future, hopefully making this a regular event for our community. We will also cater for members of the community that are not English speakers, by creating hangouts for Spanish speaking, Russian etc. The goal is to engage as many members as possible!

The love and trust you all have shown to our framework is what drives us to make it better, push performance, introduce more features and make Phalcon the best PHP framework there is. 

For those that missed it, the video is below.

<3 The Phalcon Team

image image image imageimage

Introducing “Pokémon: Phalcon Edition”

Today, we have an important announcement to make. A few weeks ago we received an interesting proposal from an important japanese video-game company. They wanted us to create a game that would help children to become interested in web programming including open source alternatives like Phalcon. We are no video-game experts by far, but we decided to give it a try and the result is simply amazing.

"Pokémon: Phalcon Edition" is a new member of this saga and it is sure to be one of the favorite of its fans.

The spokesman of this company was very excited about this new project:

We never doubted that Phalcon Team could get on track with this new project. We have rescued the art of Pokémon battle in 2D, but we have introduced elements of the web programming world. 

This game will include a new Framework Pokemon type, the 19th type of Pokemon to be introduced to the franchise. The Framework type is super effective against bugs and bad programming practices.

I can’t say more but It will certainly be one of the most exciting games of this year!

A sample of the progress of the game can be seen in the following video:

The game will be available for iOS and Android starting this summer!


Update: No Pokemons were harmed in the making of that video, that was our April Fool’s Joke LOL :D

Phalcon statistics

As with any project, statistics are always good to have around. Whether this is personal curiosity or showing off, statistics help us make decisions.

For those that are wondering what languages are used to make Phalcon, below is a table that might prove helpful.

The output has been created with cloc.

Language                      files          blank        comment           code
C                               361         108511          46708         327574
PHP                             255           7816           6557          35404
Bourne Shell                     14           5891           5302          34188
m4                                9           2263            882          20732
Bourne Again Shell               10           2738           4109          16963
SQL                               3            250            250          13336
C/C++ Header                    344           5653           6621          10799
yacc                              3            710             57           2032
make                              5             52              0           1065
XML                               2             15             15            119
awk                               2             15             22             70
Python                            1             20              1             53
YAML                              1              7              0             31
CSS                               2              2              0             12
Pascal                            1              4              4              4
Javascript                        2              0              0              2
SUM:                           1015         133947          70528         462384

C is king. However things will change once 2.0.0 is out, making Zephir the top language.

<3 The Phalcon Team

Phalcon 1.3.0 Released

Right after our 2 year celebration and several months of development, more than 1,500 commits and a lot of improvements and fixes, Phalcon 1.3 is finally released!

Many important internal aspects of Phalcon have been rewritten and enhanced without breaking compatibility with older versions.

Phalcon 1.3 consolidates the research, testing and implementation of new ways to improve the performance in the Phalcon kernel, which is also the heart of the extensions created by Zephir in Phalcon 2.0.

The CHANGELOG for this version is huge. Some key improvements are:

Disabling Literals

Literals can be disabled in PHQL, this means that directly using strings, numbers and boolean values in PHQL strings will be disallowed. In Phalcon 1.3 this option has been improved and now works with
most query builders, finders and PHQL generators.

Phalcon\Mvc\Model::setup(array('phqlLiterals' => false));

$phql = "SELECT Robots.* FROM Robots WHERE Robots.type = :type: LIMIT :limit:";

$result = $this->modelsManager->executeQuery($phql, array(
	'type' => $this->request->getPost('name')
	'limit' => $this->request->getPost('limit')


A widely requested by the community component, Phalcon\Registry is introduced in this version. This component implements the Registry pattern, allowing the developer to store and retrieve all kinds of values using simple keys.

$registry = new \Phalcon\Registry();

//Store a simple value
$registry->mydata = "hello";

//Store a complex resultset
$registry->robots = Robots::find();

Registries can be iterated as arrays:

foreach ($registry as $key => $value) {

And can be accessed as objects or arrays:

echo $registry->key;
echo $registry['some key'];
echo $registry[$key];
echo $registry->{$key};
echo $registry[0];
echo $registry->{0};

Ini Settings

Phalcon 1.3 introduces php.ini settings to alter the global behavior of the extension:

; Enables/Disables globally the internal events = On

; Enables/Disables virtual foreign keys
phalcon.orm.virtual_foreign_keys = On

; Enables/Disables column renaming
phalcon.orm.column_renaming = On

; Enables/Disables automatic NOT NULL validation
phalcon.orm.not_null_validations = On

; Enables/Disables throwing an exception if save fails
phalcon.orm.exception_on_failed_save = On

; Enables/Disables literals in PHQL
phalcon.orm.enable_literals = On

; Enables/Disables auttomatic escape
phalcon.db.escape_identifiers = On

PSR-3 Logger Implementation

Phalcon\Logger now implements the PSR-3 standard for loggers which allows this component interoperate with other frameworks that also implement this standard.

In addition to this, Phalcon optionally provides C implementations of the interfaces and traits required by this standard as part of the extension:

  • Psr\Log\LoggerInterface,
  • Psr\Log\LoggerAwareInterface,
  • Psr\Log\LogLevel,
  • Psr\Log\LoggerAwareTrait and
  • Psr\Log\LoggerTrait.

You can enable/disable them via the following php.ini directive:

phalcon.register_psr3_classes = On;

This also would allow other components implement and use these interfaces directly where Phalcon is installed.

Image Manipulation Component

A component that was conceived and implemented by our wonderful contributors Phalcon\Image is available for developers that need to manipulate images using GD or Imagemagick. A unified interface is provided to manipulate images using either library.

use Phalcon\Image\Adapter\GD as GdAdapter;
use Phalcon\Image\Adapter\Imagick as ImagickAdapter;

$image = new GdAdapter('my-logo.jpg');

	->crop(200, 200)
	->resize(70, 50)

For now only the most commonly used functions have been unified and implemented since both libraries provide different functionality.

Performance Improvements

TLDR: Phalcon is now faster!

The following performance improvements have been implemented in this version, they are a bit technical, you can skip them if you want:

Polymorphic Function/Method cache
Functions and methods are called directly by Phalcon using C calls taking advantage that compilers know their address/location at compile time, however, others only exist temporarily at runtime and must be resolved by Phalcon in the PHP userland. Version 1.3 has introduced a cache that remembers (when possible) the location of these very dynamic functions and methods and reuse those locations in subsequent calls to the same method/function in order to improve performance.

Global constants
Some simple and constant values such as: null, false, true, 1, 0 and others, are often used by Phalcon throughout its execution cycle. Previously, these values were (in some cases) allocated or duplicated unnecessarily. Phalcon 1.3 just made one allocation per request for these values and then they are shared everywhere where they are used reducing overall memory usage.

Memory Management
A global memory tracker is used by Phalcon to track every segment of memory allocated by the framework in order to accordingly release and free that memory when required. Earlier versions of Phalcon needed to request additional memory to track those memory segment. Phalcon 1.3 does not need to do this in most execution cycles, thus improving performance.

Internal Properties
Many of the properties previously implemented classes were Phalcon PHP userland properties. Now many of them have been rewritten to take advantage of internal properties that have a much lower overhead when reading and writing. For example, Phalcon does not need to check whether the visibility of these properties is public, protected or private, the framework knows exactly whether they can be read or updated.

Hidden Symbols
Most of the symbols and names of internal functions and structures are not exported publicly anymore allowing the compiler to perform more aggressive optimizations by knowing in advance the address of functions and knowing that those will not be overridden externally.


Big kudos to main contributors on this version: Vladimir Kolesnikov, Dreamszhu, Piotr Gasiorowski and all the army of developers behind this project that make Phalcon possible:


We hope that you will enjoy these improvements and additions. We invite you to share your thoughts and questions about this version on Phosphorum.

Enjoy and thanks for using Phalcon!

<3 Phalcon Team