Author: Awais Farooq

  • Phalcon Responses

    In Phalcon when any request is generated, the user provides the manual response or the response is given by controller. Response file is generated under Phalcon\Http\Response. Http responses are usually composed by headers and body. Example Output Methods for Response Methods Description public setDI (Phalcon\DiInterface $dependencyInjector) Sets the dependency injector public getDI () Returns the internal…

  • Phalcon Cookie Management

    Cookie is a small text file stored by browser on user system. Cookies were designed to be a reliable mechanism for websites to remember stateful information or to record the user’s browsing activity. Phalcon\Http\Response\Cookies is the directory where cookies are stored. Cookie management helps in storing cookies under the above directory during the request execution and is…

  • VOLT: Template Engine

    Volt provides Phalcon fast execution as it is very fast and designer friendly templating language written in C for PHP. It has many helpers defined to write views. Volt is inspired by Jinja and written by Armin Ronacher. Implementation Volt views are compiled in php which saves time to write php code manually. Activating Volt In…

  • Phalcon Views

    View represents the front-end of the application. It consists of HTML files embedded inside PHP code which creates the view of the application. View provides the data to the web browser from your application. Phalcon\Mvc\View and Phalcon\Mvc\View\Simple are responsible for the managing the view layer of MVC application. Integrating Views with controller Views are automatically integrated when controller…

  • Phalcon Image

    This component allows developers to manipulate image files. We can perform multiple operation on a single image file. Adapters Adapter are used to encapsulate specific image manipulator programs. The following image manipulator programs are supported: Class Description Phalcon\Image\Adapter\Gd Requires the GD PHP extension Phalcon\Image\Adapter\Imagick Requires the ImageMagick PHP extension Implementation Resizing Image We can resize…

  • Phalcon Forms

    It handles creation and maintenance of forms in the web application. Now, as we have designed a basic web-app before we would be adding signup form. Designing Signup form Change the index.phtml viewfile, add the signup page link as a controller. app/views/index/index.phtml OUTPUT: Now, we write the signup controller app/controllers/SignupController.php Initializing Form In this form, we provide…

  • Phalcon Model Transactions

    A model transaction helps to maintain the integrity of the database after the operations such as insert/delete/update/rollback etc. Transaction checks whether the operations are successfully completed or not before committing the database. Transactions are of 3 types: Manual Transactions This method is used when there is only one connection and easy transaction. This transaction can…

  • Phalcon Model Events

    Models allows user to implement events when operation such as insert/update/delete is implemented to define business rules. The following are the events supported by Phalcon\Mvc\Model: Operation Name Description Inserting afterCreate It runs after the required operation over the database system only when an inserting operation is being made. Updating afterUpdate It runs after the required…

  • Phalcon Model Behaviours

    Behaviour is shared conducts which is used by the models to reuse the code. The ORM provides an API to implement behaviours in the models. To implement behaviour we have alternative such as events and callbacks which increases the efficiency of behaviours. Build-in behaviours are as follows: Name Description Timestampable It allows to automatically updates…

  • Phalcon Models

    Model consists of information or data of the application. It manipulates the data by managing the rules. It is found under directory Phalcon\Mvc\Model which remain same for all basic application. It provides following services: Below are the lists of some features which can be Enable/Disable specific feature: Option Description Default astCache Enables/Disables callbacks, hooks and event notifications…