As part of our regular release schedule, we are happy to announce that Phalcon 2.0.3 has been released!

This version contains many bug fixes as well as new functionality that derived from community NFRs.

Phalcon 2.0 was launched a month ago. It is the new version of the fastest PHP framework, PhalconPHP. Now that some time has passed we’d like to talk about the differences between both versions, why you should upgrade to Phalcon 2.0, and why you should consider it as a development framework.

PhalconPHP is a PHP framework much like Laravel, Symfony, CakePHP, and Codeigniter (to name a few). Even though there are many frameworks Phalcon has a huge advantage over the rest: it’s source code is written in C and it runs as a PHP extension. That is the advantage it possesses. Since it’s written in C and compiled as an extension Phalcon does not have to be interpreted for each request. Instead it works like a component of PHP. It could be argued as if PHP had its own native framework since you do not have to include files or libraries to call its components. This gives Phalcon a huge boost in both speed and performance.

Example of code using Phalcon:

use Phalcon\Mvc\Controller;

class IndexController extends Controller
{
    public function indexAction()
    {
        echo "Hello! Phalcon v2";
    }
}

However, being a framework written in C is both Phalcon’s greatest strength and weakness. Most PHP developers do not have knowledge of C as a programming language. This has greatly limited the amount of contributors Phalcon has had; slowing the rate at which it can grow and mature.

Enter Zephir to the rescue.

namespace Utils;

// Zephir Code
class Filter
{
    public function alpha(string str)
    {
        char ch;

        for ch in str {
            echo ch, "\n";
        }
    }
}

Running your code on PHP

$f = new Utils\Filter();
$f->alpha("hello");

Phalcon’s creators have been conscious of this big hurdle, and they have been working hard on a solution that could very well impact the PHP community at a grander scale. Zephir was created exclusively for the development of PHP extensions and is the core for Phalcon 2.0. Zephir is a new language with similar structure to PHP that will allow the PHP community to actually participate in Phalcon’s development, and in turn help Phalcon evolve and mature quicker, offering a wider variety of options and components.

That’s right. Phalcon 2.0 was written in Zephir. That is the main difference between both versions. While Phalcon1 was written in C and compiled as an extension, Phalcon 2.0 is written in Zephir, which is in turn compiled into a PHP extension in C. At its core, Phalcon 2.0 is simply Phalcon 1.3 rewritten in Zephir. This was done to prove two things: that Zephir is reliable and that extensions for PHP can now be developed more easily.

Why upgrade to Phalcon 2.0?

It is a simple matter of code integration and security. It is never a good idea to work off of old frameworks versions. The main force behind the advice for upgrading is simple: Phalcon 2.0 is Phalcon 1.3. Upgrading to the latest version (2.0.2 at the moment of this article) shouldn’t be a problem. Backwards compatibility is guaranteed.

This new version of Phalcon guarantees several things for the community:

It will allow the framework to grow quicker because more people will be able to contribute.

There is a new programming language with the ability of allowing everyone to write PHP extensions with ease.

At its core Phalcon 2.0 is still Phalcon 1.3, but written in Zephir.

Why should you consider PhalconPHP?

You should consider it not only for it’s speed and performance, but also because it’s unshackled. You can organize your project in any way you want, following the latest tendencies the PHP community is adapting.

  • Dependency Injection (DI)
  • Command Line Interface (CLI)
  • Access Control List (ACL)
  • Micro API
  • Object Relational Mapping (ORM)
  • Template Managers (Volt)
  • Memcache Drivers
  • Beanstalked Drivers
  • Security (OAUTH, HMAC)
  • And many other things…

If you still have any doubts feel free to comment on them and we will answer your questions or concerns. Feel free to consult the cheat sheet or the PhalconPHP forums first to see if what you need is already answered there.

Resources

Zephir - [https://zephir-lang.com][https://zephir-lang.com]

The development of Phalcon has been accelerated since we released 2.0.0. More and more contributors find Zephir very easy to understand and work with, and as a result it is time to release Phalcon 2.0.2. This version includes many features, bug fixes and improvements in terms of performance:

PhalconPHP has been quickly gaining popularity in the PHP community. Their different approach to how a PHP framework should be has garnered them as much followers as despisers. All in all we are convinced Phalcon is here to stay and it will have a much greater impact that most developers think in the near future.

For this we decided to do an interview with the main figure behind what’s pushing Phalcon forward, Andrés Gutiérrez.

// Example of Phalcon Micro , for creating API's
$app = new Phalcon\Mvc\Micro();

// Returning data in JSON
$app->get('/', function () {
    echo json_encode(array("Welcome to Phalcon 2.0"));
});

$app->handle();

Have you ever thought of writing a framework for another language?

Yes, of course! They were more like hobby projects though. I’ve tried to write frameworks for Go, Rust, C and Clojure, but were all left as prototypes.

Why PHP?

PHP, despite all of its unfounded criticism, has always been my favorite language. It makes me feel greatly productive and it was the language that first allowed me to create software for the web, something that really inspires me. PHP continues to evolve on many aspects on a daily basis and I think this is something that excites us all.

What was your inspiration for the development of Phalcon?

Mainly my experience with Ruby on Rails and Seam for Java. I’ve been creating custom open source frameworks in PHP for businesses since 2005, which has contributed in great part to my vision of how a framework for PHP should be, and what developers need.

How hard was it to get started on Phalcon?

We started the idea for Phalcon around 2011, which was called Spark back then. We later decided to change the name to Phalcon based on the combination of the words PHP and Falcon. The first concept test and the prototype of the framework took us around one year of interrupted work. In the beginning we were faced with many technical challenges which we could overcome to launch a beta at the start of 2012. Up to this date Phalcon has evolved and is substantially different to when it was launched.

What do you consider to be Phalcon’s weak point?

In general terms, being written in C is both it’s strongest and weakest points. Finding collaborators that had the necessary skills to contribute to the core of the framework wasn’t and still isn’t an easy task. Now with Phalcon 2.0 being written in Zephir the number of collaborators has increased and I am quite happy for it.

What would you say is the greatest value that Phalcon has brought to the PHP community?

In its conception Phalcon was an out of the box idea, to propose a different way of doing things. Three years ago performance wasn’t such a big deal as it is today. I think Phalcon has contributed and influenced in this sense, in helping the developer to quickly and easily construct web sites and PHP applications, taking into account the performance of the framework.

When do you expect to launch Phalcon 2.0?

It launched on April 17 of 2015.

How long have you been developing in PHP?

I started to program when I was 12 years old and with PHP when I was 16 (13 years ago), using PHP 3.0 in college. :)

How is a normal day in your life?

I actually work for a video game company and spend a lot of time in the office. After work I relax myself playing a game, watching a movie, doing sports or taking a few beers with friends.

What are your thoughts on other frameworks? In particular Zend, Symphony and Laravel?

The framework market for PHP is colossal, there are dozens of frameworks that have been around for many years and it’s relatively easy to find one that adapts to the needs, experience and knowledge of everyone.

Personally I haven’t used other PHP frameworks actively any particular development. However I believe that frameworks for PHP (as in other languages) are improved stemmed adaptations from frameworks from other languages like Ruby on Rails or Spring. Therefore most frameworks implement strong similarities in their design patterns and do things in similar ways, which is positive for developers because it reduces the learning curve and helps expand the knowledge of web development in general.

What are your thoughts on the Zephir’s reception?

There are many developers that are interested in the evolution of Zephir and they are contributing so that it keeps getting better. I don’t think that creating an extension for PHP has ever been this easy.

Where did you get your inspiration for Zephir?

Zephir is the culmination of several personal ideas and others, already well established and matured, from Rust, PHP and Javascript. Creating a programming language has been an enriching experience. Creating a language from scratch is probably not the best and most pragmatic idea, but I personally think there is no better language in which to have written Phalcon 2.0 and at the same time accomplish other proposed objectives. Zephir combines the elements we wanted from C and PHP in one unified language.

Which IDE do you use?

Mainly text editors like Sublime or Atom souped up many plugins. When I require and IDE for PHP my first choice is without a doubt PHPStorm.

What comprises your working environment? (Operating systems, coding tools, work tools, type of computer, etc.

I normally work on Sublime to develop in PHP/C/Zephir, MongoDB as a database and on an iMac computer.

Could we get a picture of your working environment?

Why haven’t you promoted Phalcon more extensively?

Phalcon has been promoted as much as it can be. Personally I’ve done many presentations and am constantly sharing our advances on social networks. The promotion of a framework comes mainly from the community’s effort, assisting to different conferences around the world and talk with people, sharing accomplishments, tutorials, tips and other useful information through social networks greatly increase Phalcon’s presence.

What are your thoughts on PHP 7?

PHP 7 is a great leap forward for PHP, which has been steadily and significantly evolving since version 5. It implements much needed characteristics and opens up new opportunities so that other interesting improvements are made in the future.

How will Zephir evolve with all the changes coming with PHP 7 and it’s new engine?

Progress has been made with experimentation on code generation for PHP 7. We hope to soon have a better integration from which Phalcon and the community may benefit from.

What’s your vision on Phalcon’s and Zephir’s future? What’s next?

Phalcon 2 depends entirely on whether Zephir can deliver, so we want Zephir to be as good as it can be so that Phalcon can be too. Subsequent versions of Phalcon 2 will include much needed improvements regarding actual components required by the community. We also have to take into account that we didn’t introduce many elements that could break current compatibility. So our plan is for Phalcon 3 to create a version from scratch exploring other design patterns and other ways of working.

Today we’re releasing Phalcon 2.0.1, this version fixes bugs and adds new features in the 2.0 series, the following is the CHANGELOG:

The wait is over! Phalcon 2.0 is here!

After more than a year of development, we’re extremely excited to announce the release of Phalcon 2.0 (final).

Those that have been following the project closely, know that this has not been a small feat.

Phalcon 2 is the a major upgrade to the framework and will be released April 17th, 2015. This new version is a rewriting of about 85% total code from C to a high-level language we have created called Zephir.

Upgrading to the latest version has several benefits:

Today we’re pleased to announce the first release-candidate for Phalcon 2.0. This release has been quite a while in the making, and includes new features, improvements and a clean and friendly code base.

As with all pre-release packages, this is not for production use. But if you’d like to take some of the new features for a spin, or to help find and fix bugs (which should be reported to the issue tracker).

This post has been cross posted from Lezgro’s blog, written by Pavlo Pastushenko

Lezgro: Phalcon Framework Remains Solid Choice Among Technology Stack We Work With!
Projects
We're a nonprofit organization that creates solutions for web developers. Our products are Phalcon, Zephir and others. If you would like to help us stay free and open, please consider supporting us.