Deploying a Symfony 4 application to Heroku (with Webpack!)

Jon Torrado
Sep 27, 2018 · 3 min read

Prerequisites

Installing Heroku client

brew install heroku/brew/heroku
sudo snap install heroku --classic

Deploying the application

heroku login
heroku create
heroku config:set SYMFONY_ENV=prod
web: $(composer config bin-dir)/heroku-php-apache2 public/
nested:
type:
stream
path: "php://stderr"
level: debug
git push heroku master
git push heroku your_branch:master
heroku buildpacks:add --index 1 heroku/nodejs
=== sexyproject Buildpack URLs
1. heroku/php
2. heroku/nodejs
"scripts": {
"build": "webpack -p --config ./resources/webpack/webpack.config.js --display-error-details",
"watch": "webpack -d --watch --config ./resources/webpack/webpack.config.js --display-error-details",
"heroku-postbuild": "webpack -p --config ./resources/webpack/webpack.config.js"
},
git push heroku master

Jon Torrado

Written by

CTO and co-owner at GamersWalk — IT lover

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade