Skip to main content

What is Phalcon?

What is Phalcon??

What is Phalcon?
What is Phalcon

Phalcon is developed by group of developers where Andres Gutierrez was their team head. Phalcon is an open-source framework of PHP programming language. It is based on Module View Controller (MVC) pattern. Phalcon is the first framework that implements ORM in C-programming language.

Phalcon Application Structure

Phalcon key feature is that it is a loosely coupled framework. Phalcon allows user to build project with a directory structure that is convenient for specific application. It follows MVC and has "Standard Structure". Phalcon has the following directory structure for a project:
//structure layout

Application: It contains the config, controllers and views resource folder. This directory defines all the functionality of an application. It consists of vital scripts and files which runs on the server.
Configuration: It defines the configuration properties of the application. It consists of four files:
  1. Config.php: It provides the nested object property based user interface. It helps in accessing the configuration data within application code.
  2. Loader.php: It allows us to load all the project class automatically. Since, this component is written in C, it provides lowest overhead for external PHP files.
  3. Router.php: It allows us to define the routes that are mapped to controllers or handlers. Controllers receive the request due to mapping. A router simply parses a URI to determine this information.
  4. Services.php: It implements dependencies injection and location of services.
Controllers: All the methods defined under controllers handle the requests. By default all the methods on the controller are map to actions.
Views: It represents the user interface of your application. Views consist of html files embedded with PHP code that perform task accordingly.
Cache: It is a class under Phalcon directory which allows faster access to frequently used data. This class is written in C programming language. It provides high performance and reduced overhead.
Public: It includes all those files and folder which supports the main content in execution such as CSS, JavaScript, images etc.

Phalcon MVC (Model View Controller) Architecture

Phalcon consist of object oriented classes to implement MVC architecture. MVC is a framework which is used to develop web frameworks and desktop applications. Some advantages are:
  • Business logic is isolated from database and user interface layer.
  • Very easy maintenance of code as different section is created for difficult codes.

Models

Model represents the data or information of the application. Most of the business logic of our application is in model. It describes the rules to manipulate the data. It helps in interaction with the database table. In most cases each table corresponds to one model in our application.

Views

It represents the user interface of our application. Views consist of HTML pages and PHP code embedded within to perform different tasks. It handles the requests generated by your application by providing data to the web-browser.

Controllers

It provides the flow between model and view. It processes the requests from the web-browser then re-checks from model and delivers the result to the views.

Comments

Popular posts from this blog

Build chatbot with node js and react js

User Experience is given a lot of attention while building any application these days. More and more brands are leveraging chatbots to service their customers, market their brand, and even sell their products. There are a lot of awesome tools out there which helps in building an intelligent bot very easily like Google’s DialogFlow, Amazon Lex, etc, most of which implement their own Natural Language Processing (NLP) logic. However, in some cases, we don’t really need an intelligent bot. Whenever we have a small application having a limited set of options to choose from, it’s not really necessary to use NLP based tools like Google’s DialogFlow. You need to integrate with them (which is pretty easy though), and you need to make a network call to get the results. Instead, you would want to define your rules locally in those cases. Here we will build a simple chatbot using React Simple Chatbot library and add it to our pizza-builder app using which we can build ou...

PHP Image Upload with Size Type Dimension Validation

File upload feature requires basic validations to  make clean and hygienic  the user input. There is a huge chance of exploiting a file upload option with malicious intent. Improper implementation of a file upload input increases security vulnerability. We need to validate the uploaded files before saving them on the server to reduce the vulnerability. I have created a HTML form and provided an option to upload files. When the form is submitted, the file binaries are sent to the PHP and validated in the server side. I have checked if the uploaded file is an image and I have specified the allowed image extension, size and dimension based on which the validation is taking place. After all these validations have passed, the image file is saved in the target location as specified. The server-side image file validation takes place in the following aspects. If the file is not empty. If the file extension is one of .jpg, .png, .jpeg. If the file size is le...

PHP in Website Development Era

If you guys are watching this page its sure you want to check more about PHP.PHP language has a unique place in website development. It was introduced at a right time when web-based business was in new trend. Over a period it became one of the popular languages for creating web applications. The reasons are, simple language structure unique features  free license. PHP’s  unique features  lead to more popularity. Since 1994 when PHP development was started, we have seen the following version releases. PHP Versions Versions Key Features Description PHP/FI (1995) Form handling Perl/CGI script (PHP 1.0) introduced by  Rasmus Lerdorf . The Expansion is  Personal Home Page / Form Interpreter . PHP/FI2 (1997) Data conversion Form data export With slight modifications in Form Interpreter(PHP 2.0) to handle form entries. PHP  3 – (1998) PHP core is rewritten PHP parser is rewritten. Zend Engine is incorporated. Language core wa...