Easy Deployment of PHP Applications with Deployer
Everybody tries to automate their development process, testing, code formatting, system checks, etc. This is also the case for deploying our applications or pushing a new version to the production server. Some of us do this manually by uploading the code using an FTP client, others prefer Phing, and Laravel users will prefer Envoyer for this process. In this article, I’m going to introduce you to Deployer – a deployment tool for PHP.
I will be using an application from a previous article for the demo. The application will be deployed to a DigitalOcean droplet. To follow along, you can clone the demo application’s source code from GitHub.
mv deployer.phar /usr/local/bin/dep chmod +x /usr/local/bin/dep
After cloning the demo repository, we need to create a new file called
deploy.php where we’ll define our deployment steps.
The first step is to define our deployment servers. We can authenticate normally using a username and a password.
// deploy.php server('digitalocean', '126.96.36.199') ->user($_ENV['staging_server_user']) ->password($_ENV['staging_server_password']);
We can also define the type of this server (
production, etc), which allows us to run tasks (more on tasks later) on a specific server stage.
Continue reading %Easy Deployment of PHP Applications with Deployer%