Problem:

When we use a function json_encode return string type only. For example:

{
  id: "1",
  name: "thinh",
  phone: "0909999999"
}

Solve

Firstly, you need to install some libray mysql to do it just following comand below

sudo apt-get purge php5-mysql  
sudo apt-get install php5-mysqlnd

After that Update config to MySQL connection with 2 options ATTREMULATEPREPARES and ATTRSTRINGIFYFETCHES

$db = new \Phalcon\Db\Adapter\Pdo\Mysql([
  "host"     => $config->database->host,
  "username" => $config->database->username,
  "password" => $config->database->password,
  "dbname"   => $config->database->dbname,
  "charset"  => $config->database->charset,
  'options' => array(
    \PDO::ATTR_EMULATE_PREPARES => false,
    \PDO::ATTR_STRINGIFY_FETCHES => false,
  )
]);
$di->set('db', $db);

And go to Url to test agian wich the result like this

{
  id: 1,
  name: "thinh",
  phone: "0909999999"
}

Refer from http://thinhvoxuan.me/phalconphp-sql-data-type-is-string-only/`