You can declare the port in the services and config
<?php
// config
return new \Phalcon\Config(array(
'database' => array(
'adapter' => 'Postgresql',
'host' => 'localhost',
'port' => '5432'
'username' => 'postgres',
'password' => '123456',
'dbname' => 'database',
),
<?php
// services
$di->set('db', function () use ($config) {
return new DbAdapter(array(
'host' => $config->database->host,
'port' => $config->database->port,
'username' => $config->database->username,
'password' => $config->database->password,
'dbname' => $config->database->dbname,
));
});