Phalcon 1.1 beta released!

Read time: 3 minutes

After our successful 1.0 release, we continue improving Phalcon with our latest release 1.1.0 (beta). In this article, we’re highlighting the most important features introduced:

QueryBuilder Paginator

In addition to the ModelResultset and NativeArray paginator, this version introduces the QueryBuilder paginator which uses a SQL LIMIT/OFFSET clause to obtain the requested results. This paginator is suitable to handle large datasets.

use Phalcon\Paginator\Adapter\QueryBuilder;

$builder = $this->modelsManager->createBuilder()
        ->columns('id, name')

$paginator = new Paginator(array(
    "builder" => $builder,
    "limit"=> 10,
    "page" => 1

$page = $paginator->getPaginate();

Beanstalkd Queuing client

A simple client for the Beanstalkd queuing server is now available as part of Phalcon:


// Connect to the queue
$queue = new Phalcon\Queue\Beanstalk(
        'host' => ''

// Insert the job in the queue (simple)
$queue->put(array('processVideo' => 4871));

// Insert the job in the queue with options
        'processVideo' => 4871
        'priority' => 250,
        'delay'    => 10,
        'ttr'      => 3600,

while (($job = $queue->peekReady()) !== false) {

    $message = $job->getBody();




This version includes a simple class to encrypt/decrypt data based on the PHP’s mcrypt library.

// Create an instance
$encryption = new Phalcon\Crypt();

$key  = 'le password';
$text = 'This is a secret text';

$encrypted = $encryption->encrypt($text, $key);

echo $encryption->decrypt($encrypted, $key);

Assets Management

This component eases the task of adding static resources such as CSS scripts and Javascript libraries to then output them in the views:

// Add some local CSS resources

// and some local javascript resources

Then in the view:

        <title>Some amazing website</title>
        <?php $this->assets->outputCss() ?>

        <!-- ... -->

        <?php $this->assets->outputJs() ?>

Exception mode in ORM Validations

By default, when some of the validators in a creating/updating process fails, the methods save()/create()/update() return a boolean valuestating the success or failure of this operation. Now, you can change this behavior to use exceptions:

use Phalcon\Mvc\Model\ValidationFailed;

try {

    $robot = new Robots();
    $robot->name = 'Bender';

} catch (ValidationFailed $e) {
    echo 'Reason: ', $e->getMessage();

Hostname routing

Phalcon\Mvc\Router now accepts hostname restrictions on their routes

$router = new Phalcon\Mvc\Router();

        'module'     => 'api',
        'controller' => 'robots',
        'action'     => 'index'

Or use a group:

$group = new Phalcon\Mvc\Router();


        'module'     => 'api',
        'controller' => 'robots',
        'action'     => 'index',

        'module'     => 'api',
        'controller' => 'robots',
        'action'     => 'show',


Use Controllers in Mvc\Micro

To organize better micro applications, now you can set up classes as controllers

$collection = new Phalcon\Mvc\Micro\Collection();

// Use direct instantiation
    ->setHandler(new PostsController());

// Lazy instantiation
    ->setHandler('PostsController', true);

$collection->get('/', 'index');

$collection->get('/edit/{id}', 'edit');

$collection->delete('/delete/{id}', 'delete');


1.1.0 includes other minor changes, bug fixes, stability and performance improvements. You can see the complete CHANGELOG here. Check the documentation for this version

Help with Testing

This version can be installed from the 1.1.0 branch:

git clone
cd build
git checkout 1.1.0
sudo ./install

Windows users can download a DLL from the download page.

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


Chat - Q&A


Social Media


<3 Phalcon Team

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.