Skip to content

simplonco/push-me-to-prod-like-a-pro

Repository files navigation

Push to production like a PRO! Build Status

Learn how to put a real app online

Indiana Jones

Step 1 - Install Composer

https://getcomposer.org/ is a dependency manager for PHP!

php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php -r "if (hash_file('SHA384', 'composer-setup.php') === 'e115a8dc7871f15d853148a7fbac7da27d6c0030b848d9b3dc09e2a0388afed865e6a3d6b3c0fad45c48e2b5fc1196ae') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"
php composer-setup.php
php -r "unlink('composer-setup.php');"

sudo mv composer.phar /usr/local/bin/composer

Step 2 - Generate a Composer config

  • for a simple PHP project:
composer init
  • for a Symfony app:
composer create-project "symfony/framework-standard-edition:^3.0" new-symfony-project
  • Learn more about:

http://boulogne.simplon.co/wp-content/uploads/2016/03/Tutoriel-PHP-Composer.pdf

Step 3 - Push to Prod - the Heroku way

Try to deploy your app on heroku, that's simple and free!

Start by following the guide Getting Started on Heroku with PHP: https://devcenter.heroku.com/articles/getting-started-with-php

Next, read the Getting Started with Symfony on Heroku tutorial: https://devcenter.heroku.com/articles/getting-started-with-symfony

Basically you have to do:

# Run this from your terminal:
# Please ensure that you have Ruby installed.
wget -qO- https://toolbelt.heroku.com/install.sh | sh
# Create an Heroku instance
heroku create
# If you use Symfony set env to PROD
heroku config:set SYMFONY_ENV=prod
# Push to PROD
git push heroku master

At the end, you will get your app online, e.g:

Heroku