A magical PHP Framework: The first knowledge of Phalcon

Source: Internet
Author: User
Tags php framework

Objective

The company's app response rate is slow, the company God decided to use the C language PHP framework Phalcon instead of the original framework, the response speed has a relatively large increase. I've only heard of it before, not in-depth understanding. That is, the work is useful to, then take a moment to understand the next, you do not understand anything, will be despised by others, need to constantly recharge their own short board AH!


First Impression

Took some time to read the Phalcon framework of the document, the framework has a general understanding of some of my feelings.

1 The main Code C language, the implementation of the efficiency of the other pure PHP than the framework to write higher;
2 Framework function chatty, full stack frame, Web development related components are, components are low coupling;
3 object containers and the magical use of dependency injection, simplifying code writing;
4 Many components use adapter mode, easy to customize development extension, as long as the implementation of the adapter interface;
5 Safe and reliable, the Common vulnerability of the Web provides a corresponding solution, which is very helpful for team development, think about some recent off-library events, or some scared, the development of security awareness is very important;
6 PHQL Class SQL database query language, query data is very flexible, feel this does not use;
7 This framework is flexible, there is no fixed paradigm, the development can be arbitrarily organized code;
8 to provide development scaffolding, boring repetitive operations have the corresponding script to do, is my lazy people love:)
9 Command Line Execution Task console
10 Event manager Hook mechanism, this must be very cool to use:)
11 role-based simple rights management mechanism, for resource rights management is not complex application is absolutely enough


Framework Architecture

Previous contact with more than the framework, such as Ci,qeephp,laravel, found that everyone's implementation of the routine almost, no outside of the MVC three-layer architecture on the basis of doing some articles, the way to achieve differences.

Single entry
Handle the client response through a portal, which requires setting up the Web server to forward all dynamic script requests to a single portal


Routes and Distributors
The routing rules need to be set, along with the corresponding processing controllers and methods of the route, and after the matching route is found, through the dispatcher forwarding execution, there is a routing component and a dispatcher component to implement these 2 functions


Controller
Used to respond to client requests for connecting model and view-to-glue


Model
Business logic layer, data crud operation correlation, model correlation relationship Management


Cache Layer
Using the adapter mode, the backend supports the mainstream cache service, such as Memache,redis, MongoDB, etc., if you need to use other services, you can expand, implement the adapter interface on the line


View
Client view rendering, hierarchies, view inheritance, support for built-in templates, and custom template engines


Multi-lingual
Support multi-lingual, this to the company's business is mainly in the overseas very helpful, saying that their implementation is not difficult, but also a language package, using the PHP array can be:)


Advantage

1 function Chatty

2 Fast Execution speed


Disadvantage

1 High learning costs

2 need to install PHP extensions
3 High Maintenance cost compared to pure PHP framework


Fit scene

1 need for rapid development and high performance requirements

Dependency Injection

Dependent services are accessed through injection, which is the foundation of the Phalcon framework, with the ability to achieve low coupling between components and access to other services through dependency injection. Dependency Injection comparison around, the first understanding may be confused, familiar with after the good. The Phalcon document is very vivid and specific to the dependency injection, starting with the problem and guiding how to implement the dependency injection in one step. Dependency Injection Implementation principle: Create an object container, register the service to the object container, need to access the service instance through the object container to access the service, different language implementation way.

Postscript

Said things very theory, there is no relevant practice of the part, mainly I only read the document, has not actually used, the use of the process will encounter what pit, I now say not clear): After the new system development or amateur engaged in the project, will try to use it!

Resources

"1" Phalcon official documents

Https://docs.phalconphp.com/en/latest/index.html

Https://media.readthedocs.org/pdf/phalcon-php-framework-documentation/latest/phalcon-php-framework-documentation.pdf
"2" Phalcon official website

https://phalconphp.com/zh/

"3" Phalcon code base Address

Https://github.com/phalcon

A magical PHP Framework: The first knowledge of Phalcon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.