Facebook Twitter Instagram
    TecAdmin
    • Home
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    You are at:Home»PHP Framework»Create Project with Phalcon Developer Tools in Linux

    Create Project with Phalcon Developer Tools in Linux

    By RahulAugust 30, 20183 Mins Read

    Phalcon Developer Tools are very useful for creating core components for your project using simple commands. Using developer tools we can create new projects, controllers, and models in your projects.

    Advertisement

    This article will help you to install Phalcon developer tools on your system and creating a project with Phalcon Developer Tools in Linux. Before proceeding with this article you must have Phalcon PHP extension enabled in your system. Visit the following URL to install this extension.

    >> Install Phalcon PHP Framework on Ubuntu

    Install Phalcon Developer Tool

    Phalcon Developer Tools can be installed using two methods described below. Select one method only.

    Method 1 – Using Git Source

    Phalcon developer tools can be install simply downloading source code and create a symbolic link to bin directory. Use following commands to do it.

    cd /opt
    git clone https://github.com/phalcon/phalcon-devtools.git
    ln -s /opt/phalcon-devtools/phalcon.php /usr/local/bin/phalcon
    chmod +x /usr/local/bin/phalcon
    

    Method 2 – Using Composer

    Using this method you must have composer installed your system. Don’t have composer ? Visit here.

    Create a composer.json file under /opt/phalcon/ directory using following content

    mkdir /opt/phalcon && cd /opt/phalcon
    vim composer.json
    
    {
        "require": {
            "phalcon/devtools": "dev-master"
        }
    }
    

    Now execute following commands to install tools and create symbolic link to systems bin directory

    cd /opt/phalcon
    composer install
    ln -s /opt/phalcon/vendor/phalcon/devtools/phalcon.php /usr/local/bin/phalcon
    chmod +x /usr/local/bin/phalcon
    

    Check Available Phalcon Commands

    At this stage, you have successfully configured Phalcon Developer Tools in your system. To check all available commands for creating and managing project use following command.

    phalcon commands
    
    Phalcon DevTools (3.4.0)
    
    Available commands:
      info             (alias of: i)
      commands         (alias of: list, enumerate)
      controller       (alias of: create-controller)
      module           (alias of: create-module)
      model            (alias of: create-model)
      all-models       (alias of: create-all-models)
      project          (alias of: create-project)
      scaffold         (alias of: create-scaffold)
      migration        (alias of: create-migration)
      webtools         (alias of: create-webtools)
      serve            (alias of: server)
      console          (alias of: shell, psysh)
    

    Create A Sample Project

    To create a project using Phalcan developer tools, execute the following command. It will create a directory structure for your project.

    cd /var/www
    phalcon create-project myapp
    

    Let’s create a virtual host in your Apache server like below. Nginx users read this to create server block.

    <VirtualHost *:80>
            ServerAdmin [email protected]
            ServerName phalcon.example.com
            DocumentRoot /var/www/myapp/public
            <Directory /var/www/myapp/>
                Options all
                AllowOverride all
            </Directory>
    </VirtualHost>
    

    After adding above host restart your web server and access website in your browser. You will see default content like below. To change content of default page edit myapp/app/views/index/index.phtml file and add your own content.

    Framework phalcon phalconphp PHP
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp

    Related Posts

    How to Prevent SQL-injection in PHP using Prepared Statements

    Preventing SQL injection attacks with prepared statements in MySQL

    PHP Arrays: A Beginner’s Guide

    View 3 Comments

    3 Comments

    1. Waheed on September 21, 2017 11:08 am

      chmod +x /usr/local/bin/phalcon
      chmod: cannot operate on dangling symlink ‘/usr/local/bin/phalcon’
      [email protected]:~$ phalcon commands

      Reply
      • Turarbek on August 28, 2019 3:26 pm

        After the “`composer install“` command run this command before using “`ls -s command“`:
        “`
        sudo mv /opt/phalcon/vendor/phalcon/devtools/phalcon /opt/phalcon/vendor/phalcon/devtools/phalcon.php
        “`
        for rename file phalcon to phalcon.php. Because, I don’t know why, but in the git they downloaded a phalcon file with the name just phalcon, not phalcon.php. So we need to rename this file.

        Reply
    2. chandra sekhar on May 10, 2016 7:13 am

      Hi thanku very much and it is useful for me.

      Reply

    Leave A Reply Cancel Reply

    Advertisement
    Recent Posts
    • Implementing a Linux Server Security Audit: Best Practices and Tools
    • cp Command in Linux (Copy Files Like a Pro)
    • 15 Practical Examples of dd Command in Linux
    • dd Command in Linux (Syntax, Options and Use Cases)
    • Iptables: Common Firewall Rules and Commands
    Facebook Twitter Instagram Pinterest
    © 2023 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.