Once you have Phalcon PHP extension installed and working on your web server you are about half way to creating your first app. You need to get the developer tools downloaded and installed. The developer tools contain a range of scripts which allow you to quickly and easily generate code for your phalcon mvc project. The phalcon-devtools project is hosted on github and can be downloaded in a number of ways.
If you are familiar with composer the devtools can be installed easily using composer (composer require phalcon/devtools).
Many people reading this will not necessarily be familiar with dependency management systems such as composer. For this reason, this post will describe how to get started using devtools in the simplest possible way in a windows environment.
Go to the devtools github site click here
Click the latest release.
Click "Clone or Download" - Click "Download Zip"
Extract the archive. The resulting folder will be called phalcon-devtools-*.* where *.* is the version number. Rename this folder simply to phalcon. The resultant folder structure will look something like this:
You can place this folder structure wherever you like using the approach I'm about to demonstrate but I normally place it in the root directory of the c drive. So my phalcon developer tools are installed in c:\phalcon.
In the environment where I work not everyone has administrator access to the computer they are working on. Given this, it has been important to be able to adapt and installing both xampp and phalcon in folders where there is at least save and execute permissions. Typically this is c:\user\username.
The typical approach at this point would be to edit your environment variables and include the c:\phalcon (or whatever folder you are using) to the search path. If you are comfortable doing this then you can skip this next step.
An alternative approach I've used is to simply modify the cmd shell script which is typically used with phalcon devtools and have it point to the folders you are using for devtools and PHP.
So in my case, the shell script looks like this.
@echo off set PHPCMD=c:\xampp\php\php set PTOOLSPATH=c:\phalcon %PHPCMD% %PTOOLSPATH%\phalcon.php %*
This file is called phalcon.bat and saved in the folder where you want to use it.
For your first project you could place it in the htdocs folder - so in my case c:\xampp\htdocs
Open a CLI (Comand Line Interface) - Windows Key and R - then type "cmd" and press enter
Change directory into your htdocs folder
To create the phalcon project type
phalcon project tennisClub
This will create a project folder and complete MVC directory structure within this folder.
Now the fun part. From here you can start to "scaffold" your code - see the next post for how to do this.