Lessons: 10Length: 46 minutes

Next lesson playing in 5 seconds

Cancel
  • Overview
  • Transcript

1.3 Set Up the Application

In this lesson, I'll show you how to set up a development environment, create a new project and check that some system prerequisites are installed.

1.3 Set Up the Application

Hey everybody, welcome back to the course. In this lesson, we are going to set up our environment, create a new project, and check some prerequisites that should be installed before we start. But before getting into anything, I would like to give you a brief introduction to my development environment. You might ask why. Well it's because I think it can be very useful for debugging process, or there can be many updated libraries by the time you will be following this course. So knowing the ones we are using in this course can be a big help just in case something doesn't work out at your end. So here we are. On the left side, you can see my text editor. I use Sublime, but you can use whichever you feel like. On the right side, I have my terminal window. And since we are going to use terminal a lot during our testing and development, I would like to have it on the same screen as my editor. And under the hood, I'm running Mac OS X 10.11. Well, this is all about my workspace. Now, we need to install Apache, PHP, MySQL, and Phalcon in the system, but covering up all the installations will go out of the scope for this course. So I'm gonna skip the installations here. But as a quick tip for installing Phalcon, you can go to phalconphp.com, go to downloads, and follow the instructions according to your operating system. Once you have successfully installed Phalcon, you can always verify your installation by typing this command. Now, if you get Phalcon, in return, that means you are good to go. Let's verify Apache, I'm using version 2.4.16. Next is PHP, and I'm using version 5.6.16. And last but not the least, our dear Mr. MySQL, and I'm using version 5.7.9. Okay, great. Now that we have everything in place, it's time to start creating our project folder. One thing that I really like about Phalcon is that it's loosely coupled, which means you don't need to follow any conventional directory structure. In fact, it's all up to you the way you want it to be. I will follow the one recommended in Phalcon documentation for the sake of this course. Okay, so let's start by going to our web root directory where Apache can read and see our projects. Then, step one is to create a project folder. I'm gonna name it phalcon-api. Step two, create an app folder. Step three, create the models folder inside the app folder. Now, the last step is to create some files. For that, let's change our directory to our project folder. The first file that we are gonna create is .ht access file. This file will contain some rules for a party server. The next file is index.php. This is a very important file. This file will act as a controlling system for our project, and we are gonna cover the HT access and index, both of them, in the coming lesson. The last but not the least, our model, which is Car.php. So finally, this is how our simple API project now looks like. With this, we have reached the end of this lesson along with the first chapter. Hey, I know it took us a little bit longer than usual with this introductory part of the course. But as they say, if you give me six hours to chop down a tree, I will spend the first four sharpening the axe. Hence, the planning and the basics are as much important as the rest of it, so I hope you really enjoyed our first chapter. We are pretty much ready to dive into some real action in the coming one. So stick with me, till then, bye bye.

Back to the top