Phalcon interview questions and answers

Phalcon is a free open source PHP framework based on MVC design pattern that is delivered to end users as a C -extension for the PHP language providing high performance and lower resource consumption.Phalcon is developed by Andres Gutierrez and written in Zephir/C.

Routing in Phalcon Framework is managed by its Router component. Router components allow you to
define routes that are mapped to controllers or handlers that should receive the request from your application.A router simply parses a URI to determine this information. The router has two modes: MVC mode and match-only mode. The first mode is ideal for working with MVC applications.

Phalcon uses an independent module “Phalcon\Validation” for validating users requests. This component can be used to implement validation rules on data objects that do not belong to a model or collection.
The loosely-coupled design of this component allows you to create your own validators along with the ones provided by the framework.
The following example shows basic usage of validations in Phalcon :

<?phpusePhalcon\Forms\Element\Text;usePhalcon\Validation\Validator\PresenceOf;usePhalcon\Validation\Validator\StringLength;$name=newText("name");$name->addValidator(newPresenceOf(["message"=>"The name is required",]));$name->addValidator(newStringLength(["min"=>10,"messageMinimum"=>"The name is too short",]));$form->add($name);

PHQL stands for Phalcon Query Language, PHQL is a high-level, object-oriented SQL dialect that allows writing queries using a standardized SQL-like language. PHQL is implemented as a parser (written in C) that translates syntax in that of the target RDBMS.

Phalcon offers the object-oriented classes, necessary to implement the Model, View, Controller architecture (often referred to as MVC) in your application. This design pattern is widely used by other web frameworks and desktop applications.

MVC benefits include:

Isolation of business logic from the user interface and the database layer.

Making it clear where different types of code belong for easier maintenance.

If you decide to use MVC, every request to your application resources will be managed by the MVC architecture. Phalcon classes are written in C language, offering a high-performance approach to this pattern in a PHP based application.

Zephir – Ze(nd Engine) Ph(p) I(nt)r(mediate) – is a high-level language that eases the creation and maintainability of extensions for PHP. Zephir extensions are exported to C code that can be compiled and optimized by major C compilers such as gcc/clang/vc++. Functionality is exposed to the PHP language

Phalcon uses a powerful and fast templating engine called Volt.Volt is an ultra-fast and designer-friendly templating language written in C for PHP. It provides you a set of helpers to write views in an easy way. Volt is highly integrated with other components of Phalcon, just as you can use it as a stand-alone component in your applications.
source (https://docs.phalconphp.com/en/3.0.0/reference/volt.html)