We will create a small PHP Application that utilizes Composer.
- composer in your PATH
Create a PHP sample application
Create a directory sample_app/web:
The web folder will be the document_root of our application.
Go into the sample_app directory:
This will download the faker library into a new directory vendor and also create valid composer files:
Create an index.php file within the web directory.
Please follow the setup on the Initial Setup page within your sample_app directory.
Install dkdeploy-php via bundler
In order to make our deployment work we will use the dkdeploy-php gem. Our Gemfile should look like this:
Now run bundle install to install the gem.
By requiring the dkdeploy-php gem in your Gemfile you will automatically have all the functionality of the dkdeploy-core gem.
Extend the Capfile
Make sure that you require the PHP tasks:
Check if the dkdeploy tasks are available
Run bundle exec cap -T
You should now get a list of all available tasks. If you see the following composer tasks among them everything should be okay:
Open the file deploy.rb in the config folder.
- We give our application the name faker-app. Capistroano will deploy this to
- We make sure that Composer is correctly set-up
Configuring the dev stage
Lets say we just want to deploy the generated output to a Vagrant VM.
deploy/dev.rb and add the following settings:
We fetch the :application variable we set in deploy.rb, so the application will deploy into /var/www/your-domain/.
We also set :keep_releases to 5. That ensures that Capistrano will keep the last 5 successful releases on the server.
You might want to have a look at the Composer section
for additional configuration options.
Next Page: Deployment