This is an example app demonstrating how to deploy a php app to runway.

Overview

Runway Example php App

This is an example app demonstrating how to deploy a php app to runway.

  • clone this repo, and navigate into that directory
  • runway app create
  • runway app deploy
  • runway open

You can then deploy changes by git commiting them, and running runway app deploy again.

This is the Symfony Demo Application, created with composer create-project symfony/symfony-demo my_project.

PHP Extensions

By default, that demo application needs sqlite support, which has been enabled by putting a custom.ini into the directory .php.ini.d, with the following contents:

extension=pdo.so
extension=pdo_sqlite.so

Webserver and PHP-FPM setup

We also configure some defaults for the buildpack in project.toml:

[ build ]
  [[ build.env ]]
    name="BP_PHP_SERVER"
    value="nginx" # we want nginx, with php-fpm
  [[ build.env ]]
    name="BP_PHP_ENABLE_HTTPS_REDIRECT"
    value="false" # no http-to-https redirects, the runway platform handles that
  [[ build.env ]]
    name="BP_PHP_WEB_DIR"
    value="public" # standard web directory for a symfony app
  [[ build.env ]]
    name="BP_COMPOSER_INSTALL_OPTIONS"
    value="" # reset composer options, standard is --no-dev

(more options are available but this is all we need for symfony)

We also tell nginx to fallback to the index.php, by putting a symfony-server.conf into .nginx.conf.d:

location / {
    # try to serve file directly, fallback to index.php
    try_files $uri /index.php$is_args$args;
}

Teaching symfony about symlinks

Buildpacks work in "layers", and because of that, vendor/ is just a symlink into a specific directory. Some symfony scripts don't like that. We fix that by specifying the full path to src for the autoloader:

--- a/content/php/composer.json
+++ b/content/php/composer.json
     },
     "autoload": {
         "psr-4": {
-            "App\\": "src/"
+            "App\\": "/workspace/src/"
         }
     },
     "autoload-dev": {
         "psr-4": {
-            "App\\Tests\\": "tests/"
+            "App\\Tests\\": "/workspace/tests/"
         }
     },
     "scripts": {

and explicitly setting the app's root-dir for symfony:

--- a/content/php/composer.json
+++ b/content/php/composer.json
     "extra": {
         "symfony": {
             "allow-contrib": true,
+            "root-dir": "/workspace",
             "require": "6.1.*"
         }
     }
 }

plus, we remove the post-install scripts, because these aren't run in the context of the app and wouldn't work:

--- a/composer.json
+++ b/composer.json
@@ -87,7 +87,6 @@
             "assets:install %PUBLIC_DIR%": "symfony-cmd"
         },
         "post-install-cmd": [
-            "@auto-scripts"
         ],
         "post-update-cmd": [
             "@auto-scripts"

Runtime Config

We also need to set APP_ENV to prod during runtime:

  • runway app config set APP_ENV=prod
You might also like...
A sample project to showcase a real world example and benchmarks for crowphp

CrowPHP Sample project This project is to showcase an example of how a real world project might look like. It has two basic endpoints to show-case the

Simple laravel5 example for tutorial

Laravel 5 example For Laravel 5.3 improved version look at this repository. Laravel 5 example is a tutorial application for Laravel 5.2 (in french the

TYPO3 Camp Rhein-Ruhr - Sitepackage Example

EXT:t3crr_sitepackage - A example TYPO3 Sitepackage Extension This extension was used in the T3CRR Talk "Sitepackage Einführung" in 2021! Notice Bewar

This example shows how to estimate pi, using generated random numbers that uniformly distributed.
This example shows how to estimate pi, using generated random numbers that uniformly distributed.

php-estimatepi This example shows how to estimate pi, using generated random numbers that uniformly distributed. Every pair of numbers produced will b

Phalcon Mooc an example API + Front End with automated tests
Phalcon Mooc an example API + Front End with automated tests

NovaMooc - a Phalcon project A Mooc project developed with Phalcon, a PHP framework. Key Features • How To Use • Contributing • Credits • License Key

This repository aims to build a fairly complete CI/CD example using GitHub workflows and actions.
This repository aims to build a fairly complete CI/CD example using GitHub workflows and actions.

CI/CD example This repository aims to build a fairly complete CI/CD example using GitHub workflows and actions. Keep in mind that the toolset used in

A list of documentation and example code to access the University of Florida's public (undocumented) API

uf_api A list of documentation and example code to access the University of Florida's public (undocumented) API Courses Gym Common Data (admissions an

Get mobile app version and other related data from Google Play Store, Apple App Store and Huawei AppGallery

Mobile App Version Get mobile app version and other related data from Google Play Store, Apple App Store and Huawei AppGallery. Installation Add to co

Check modules in app/code and vendor for PHP 8 compatibility status - PHP_CodeSniffer & php-compatibility standard
Check modules in app/code and vendor for PHP 8 compatibility status - PHP_CodeSniffer & php-compatibility standard

M2 PHP version compatibility check How To use Requires PHP 7.3+ | PHP 8 This app will run PHP_CodeSniffer with phpcompatibility/php-compatibility on t

HTMX example app that demonstrates how to use HTMX to add javascript interactivity to a serverside rendered PHP app

HTMX examle app This demo app demonstrates how to use HTMX to transform a server side rendered PHP app into a more 'interactive' app with AJAX request

Alexander Morland 3 Dec 11, 2022
Deploy your PHP code

php-deploy Deploy your PHP code, e.g. to a shared hosting. The only requirement on the deployment destination server is PHP and the ZIP extension. Usa

Simon Hatt 0 Jan 8, 2022
Learn how to deploy Laravel 7 project in GCP from scratch

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Almujeer Uddin 2 Nov 21, 2021
Hachkathon DevOps - Deploy application with docker container

Hackathon-Semesta-DevOps Nama : Islam Nurul Yakin Mail : [email protected] Sebuah Web Server menggunakan Nginx, PHP, dan MySQl di tambah dengan p

Islam Nurul Yakin 3 Jul 14, 2022
Laravel & Solana Phantom wallet example built with Bootstrap, JQuery. App connects to Phantom wallet and fetching publicKey and balance information.

Phantom Wallet Authentication Example Laravel & Solana ($SOL) Phantom wallet example built with Bootstrap, JQuery. This is a Web 3.0 app that connects

Solanacraft 3 Oct 19, 2022
My intention with this app is that new developers can have a concrete application with Laravel + VueJS where they can use it as example to learn the right way

My intention with this app is that new developers can have a concrete application with Laravel + VueJS where they can use it as example to learn the right way, implementing the best practices possible and at the same time learn how TDD is done. So this will be an example application but completely usable for any similar case.

Eng Hasan Hajjar 2 Sep 30, 2022
This example shows how to use Anychart library with the PHP programming language, Laravel framework and MySQL database.

PHP basic template This example shows how to use Anychart library with the PHP programming language, Laravel framework and MySQL database. Running To

AnyChart Integrations and Templates 23 Jul 17, 2022
Michael Pratt 307 Dec 23, 2022
The game is implemented as an example of scalable and high load architecture combined with modern software development practices

Crossword game The game is implemented as an example of scalable and high load architecture combined with modern software development practices Exampl

Roman 56 Oct 27, 2022
my personal example of Laravel clean architecture

what is this repo about Clean Architect Laravel ###run we assume docker desktop is up and running open up a terminal cd project directory run "cp .env

Sadegh Salari 37 Dec 23, 2022