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:
- Config.php: It provides the nested object property based user interface. It helps in accessing the configuration data within application code.
- 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.
- 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.
- 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
Post a Comment