Wern is a web developer from the Philippines. He loves building things for the web and sharing the things he has learned by writing in his blog. When he's not coding or learning something new, he enjoys watching anime and playing video games.
In part one, we covered the basics of Phake and demonstrated ways of executing tasks with it, covering groups, dependencies, and arguments. In this part, we’ll look at some sample real world applications of Phake. Note that the following examples are largely based on things that I usually do manually that need some sort of automation.
Uploading Files to Server
Let’s start by writing a task that will upload files to an FTP server.
As developers, we often have to do repetitive tasks such as updating the database structure, seeding the database, writing CRUD code, running tests, and uploading files to a server. Wouldn’t it be great if we could automate these mundane tasks and proceed with solving the more important problems such as making our app more secure or more usable to our users?
Phake, an automation tool written for PHP, can do those tasks for you. If you’re familiar with Ruby, it’s basically a Rake clone. In this two-part series I’m going to walk you through integrating Phake into your workflow. I will walk you through the installation, some of the basics in using Phake and then finally some real-world examples.
Phake should be installed globally via Composer:
composer global require 'jaz303/phake=*'
This makes Phake accessible from any folder, and doesn’t require you to change your project’s
If you don’t have access to the ‘composer’ command, install Composer globally.
It’s good practice to always use a version control system in any of your projects. Be it a side-project in which you are the only developer, or a team project where five or more people are working on it together. But the idea of putting your database into version control isn’t really that widespread. Often times we take the database for granted.
But like the source files in our project, the database is constantly changing too. That’s why we also need a way to track the changes that we have made and easily share it to other members of our team.
In this article we will take a look at DBV, a database version control system written in PHP for MySQL databases so you need to have PHP and MySQL installed before you can use it, along with a web server like Apache or Nginx.
An important note about this software is that it is not a stand-alone database version control system, because it needs a version control system such as Git, Mercurial or SVN for syncing changes with your team.
To start working with DBV, first you have to download the installer from their website, extract it into your project directory then rename the resulting folder to
dbv. This will give you the following path:
An alternative approach is just cloning from Github.
You can start configuring the options for DBV by creating a copy of the
config.php.samplefile and renaming it to
The most important things to update here are the first two sections. Just substitute the values for
my_databasefor the values in your current database configuration: