Git Product home page Git Product logo

heroku-buildpack-php's Introduction

Advanced PHP Heroku Build Pack

What makes it unique?

  • Faster deployments, because the runtime environment is built from precompiled binaries via Heroku's "vulcan"
  • Supports both the latest 5.3 and 5.4 versions
  • Uses the memory of the dyno more efficiently by going with NGINX and PHP-FPM.
  • Supports Composer out of the box
  • No writing NGINX configuration files: supports Classic PHP, Silex and Symfony 2 apps with simple configuration driven by your composer.json.
  • Zero-Configuration Symfony 2 deployment.

What works?

  • Basic provisioning
  • NGINX Configuration for frameworks silex and symfony2
  • Reading configuration from composer.json

Stack

  • NGINX 1.2 or 1.3
  • PHP 5.3 or 5.4
  • PHP-FPM

Detection

This buildpack detects apps when the app has a composer.json in the app's root.

Configuration

Configuration is done via a file named composer.json in the app's root.

A simple configuration could look like this:

{
    "name": "my-app",
    "require": {
        "php": ">=5.4.0",
        "silex/silex": "~1.0@dev"
    },
    "extra": {
        "heroku": {
            "document-root": "web",
            "index-document": "index.php"
        }
    }
}

This configures an app with the document root set to the project's web directory, and sets that all requests should go through web/index.php which contains the application's front controller.

Configuration Directives

This buildpack supports configuration through directives placed in the heroku key in the extra object.

framework

Default: Null

Use a framework preset for configuration. Some configuration keys cannot be overriden!

Available presets:

  • silex (needs document-root and index-document set)
  • symfony2

Example:

"framework": "silex"

document-root

Document root relative to the app root. Defaults to the app root.

"document-root": "web"

index-document

Default: "index.php"

Index Document relative to the document root.

"index-document": "app.php"

engines

Set PHP and NGINX versions.

To launch the app with PHP 5.3.23 and NGINX 1.3.14:

"engines": {
    "php": "5.3.23",
    "nginx": "1.3.14"
}

See also:

php-config

Default: []

Add directives to the php.ini.

"php-config": [
    "display_errors=off",
    "short_open_tag=on"
]

compile

Status: Not Implemented

Default: []

Run console commands on slug compilation.

"compile": [
    "php app/console assetic:dump --env=prod --no-debug"
]

Frameworks

Symfony 2

Is detected when the app requires the symfony/symfony package or when the extra.heroku.framework key is set to symfony2 in the composer.json.

This framework preset doesn't need any configuration to work.

Silex

Is used when the app requires the silex/silex package or when the extra.heroku.framework key is set to silex in the composer.json.

Options:

  • index-document: With Silex apps, this should be the file where $app->run() is called. All requests which don't match an existing file will be forwarded to this document.

Classic PHP

The classic PHP configuration is used as fallback when no framework was detected. It serves every .php file relative to the document root.

Hacking

You need the following tools to hack on this project:

heroku-buildpack-php's People

Contributors

chh avatar flaviozantut avatar marcqualie avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.