Phalcon Getting Started

Source: Internet
Author: User
Phalcon and Yaf, are written in C PHP extension, performance relative to Laravel, Yii and other frameworks relatively faster. Phalcon compared to YAF, the advantage lies in a perfect set of systems, such as code generation, caching, ORM, queues, etc. YAF is actually a simple MVC, but after all, the focus is not the same, YAF actually with some ORM, caching, some basic projects are enough. We're not going to look at that framework better or go straight to the topic and see how Phalcon is used.

Installation

There are many kinds of operating system installation methods in the official document, it is very simple is an extension, just need to find the corresponding PHP version, add the extension to php.ini. Mac OS X

Brewsearchphpxx-phalconbrewinstallphpxx-phalcon

XX represents the corresponding version of PHP, the PHP version in this article is 5.5. In general, Brew is installed in/usr/local/cellar/php55-phalcon and generates/usr/local/etc/php/5.5/conf.d/ext-phalcon.ini

If you have specified an additional profile path, Scan this dir for additional. ini files =/usr/local/etc/php/5.5/conf.d

So direct php-m to see if the extension is installed successfully is OK

Linux

If you can use Yum, apt-get, then basically similar to the Mac, it is not possible to find the corresponding version of the. So file added to the PHP extension.

Windows

Find the appropriate version of the. dll to add the PHP extension

To create your project

Here we build directly with tools provided by Phalcon, first to install tools, the official installation of various systems, here is a brief introduction to the installation under Mac.

Wget-q--no-check-certificate-o Phalcon-tools.ziphttp://github.com/phalcon/phalcon-devtools/zipball/masterunzip- Q phalcon-tools.zipmvphalcon-phalcon-devtools-* Phalcon-tools

This step is very simple to download phalcon-tools on GitHub, I found in the download is not responding, directly on GitHub downloaded, rename down to the designated location on the line

The next step is to configure the environment variables

Exportpath= $PATH:/users/scott/phalcon-toolsexportptoolspath=/users/scott/phalcon-tools

This method only takes effect temporarily, I use zsh, so I put this phrase directly to. ZSHRC, each time you open the terminal will take effect, convenient many, if you are other systems, only need to configure the appropriate environment variables.

Ln-s ~/phalcon-tools/phalcon.php ~/phalcon-tools/phalconchmod +x ~/phalcon-tools/phalcon

Note Here whether your path is correct, then you can test the success, open the terminal, enter Phalcon commands

$ phalconcommands phalcondevtools (2.0.8) availablecommands:  commands        (aliasof:list, enumerate)  Controller      (Aliasof:create-controller)  model            (Aliasof:create-model)  all-models      (aliasof: Create-all-models)  Project          (aliasof:create-project)  scaffold        (aliasof:create-scaffold)  Migration        (aliasof:create-migration)  webtools        (aliasof:create-webtools)

Next, switch to your workspace and build your project

Phalconprojectproject-name

The path is then pointed to the portal file/public/via Nginx or Apache, which is accessed via the browser.

congratulations! You ' re now flying with Phalcon. Great things is about to happen!

This page was located at Views/index/index.volt

Enable Webtools

Switch to your project, and then enter

Phalconwebtoolsenable

The following prompt appears and generates webtools.php in the public directory

Success:webtools successfully enabled!

Note: If you are through xxx.com/webtools.php

There will be a problem with JS and CSS loading, because the path in the default configuration file is http://host/phalcon/***

You need to modify the BASEURL in the/app/config/config.php application to "/"

Then you need to disable it again, and then enable Webtools

Phalconwebtoolsdisablephalconwebtoolsenable

Integrated Phpstrom Code hints

Right-click on the external libraries below your project to find the Configure PHP include path, select the "+" icon in the west of the Include path

Select the/phalcon-tools/ide/2.0.9/phalcon path and OK.

This way, the compiler will never remind the error, there is a reminder function, the development efficiency significantly improved!

Official Document Address: https://docs.phalconphp.com/en/latest/index.html

  • 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.