2. About Me
Eric Van Johnson
PHP Developer, Architect and an Organizer of SDPHP
● Twitter: @shocm
● IRC: @shocm
3. Laravel 101
We start with a standard Laravel deployment
And then a cd into our project directory
4. Unlock you lock
We want to remove ‘composer.lock’ from
.gitignore
5. Heroku Procfile
You can configure Heroku server by leveraging
a ‘Procfile’. We will use this to update our doc
root to point to our /public directory
6. Git’er Done
Next we initiate our Git repo and commit
some changes.
7. Use the --force
Your Laravel application will complain if it
doesn’t have a log file and it’s unable to
create one once deployed to Heroku. So we
will create it now and force add it to the repo
8. Commit to your choices in life
Now we can do a git commit of our project.
9. Heroku Time
You’ll need to have a Heroku account and have
the Heroku Toolbelt installed and configured.
Great place to get started:
https://devcenter.heroku.com/articles/getting-started-with-php#introduction
We’ll flash forward past this
10. Spinning up Heroku
We create our Heroku instance and deploy our
repo to it.
11. Check out your awesome app
At this time we
have our basic
Laravel
Application
deployed and
can view it.
12. Add layers to the Application
Let’s update our routes, add a controller and add
a view like a normal application.
app/routes.php app/controllers/HelloController.php
app/views/hello/index.blade.php
13. Check out your awesome app
Commit, push to
Heroku and go
to the new
route.
14. Adding PostgreSQL to your app
Why PostgreSQL and not MySQL?
● Heroku doesn’t have ‘native’ MySQL support
● In Heroku world, PostgreSQL is a first class citizen.
● There is a solution that allows you to add a MySQL to your
Heroku app called ‘ClearDB’ addon if you really want it.
● Since we are using Laravel and Eloquent, we don’t actual
care what our datastore is.
20. Create APP_ENV Variable
Remember we are detecting which environment
we are in, in start.php using the variable
‘APP_ENV’. We will need to create and add that
variable to our Heroku environment.
21. Create a migration
Now we create a migration using the normal
Laravel commands.
Commit and Push
22. Run migration
After we push our new migration we need to run
the migration in the Heroku environment.