Join us to discover how to use the PHP frameworks and tools you love in the Cloud with Heroku. We will cover best practices for deploying and scaling your PHP apps and show you how easy it can be. We will show you examples of how to deploy your code from Git and use Composer to manage dependencies during deployment. You will also discover how to maintain parity through all your environments, from development to production. If your apps are database-driven, you can also instantly create a database from the Heroku add-ons and have it automatically attached to your PHP app. Horizontal scalability has always been at the core of PHP application design, and by using Heroku for your PHP apps, you can focus on code features, not infrastructure.
12. III. CONFIGURATION
Store config in the environment.
Assumption:
same code but different configuration per deployment target
13. III. CONFIGURATION
Store config in the environment.
$transport = Swift_SmtpTransport::newInstance(
getenv('EMAIL_HOST'), getenv('EMAIL_PORT')?:25
)
->setUsername(getenv('EMAIL_USERNAME'))
->setPassword(getenv('EMAIL_PASSWORD'))
;
Assumption:
same code but different configuration per deployment target
14. V. BUILD, RELEASE, RUN
A build step vendors dependencies, prepares assets, etc.
A release step creates a package from build and config.
A runtime step executes, without special knowledge.
15. V. BUILD, RELEASE, RUN
A build step vendors dependencies, prepares assets, etc.
A release step creates a package from build and config.
A runtime step executes, without special knowledge.
16. X. DEV/PROD PARITY
Keep dev, stage and prod envs as similar as possible.
17. X. DEV/PROD PARITY
Keep dev, stage and prod envs as similar as possible.
SQLite ≠ MySQL
Apache ≠ Nginx
File based sessions ≠ Redis based sessions
18. X. DEV/PROD PARITY
Keep dev, stage and prod envs as similar as possible.
SQLite ≠ MySQL
Apache ≠ Nginx
File based sessions ≠ Redis based sessions
19. X. DEV/PROD PARITY
Keep dev, stage and prod envs as similar as possible.
SQLite ≠ MySQL
Apache ≠ Nginx
File based sessions ≠ Redis based sessions
If apt-get or brew don't get the job done on your box:
Vagrant is always your friend!
21. XI. LOGGING
Treat your logs as a stream of events.
Stop rotating logs and so forth in your app.
Let the runtime worry about it.
Log to STDOUT/STDERR.
Centrally archive it.