Giter VIP home page Giter VIP logo

heroku-buildpack-laravel's Introduction

Heroku Buildpack: Laravel

Laravel Heroku Buildpack

Forked from the Official Heroku PHP Buildpack with added support for Laravel Applications.

Usage

You'll need to use at least an empty composer.json in your application.

echo '{}' > composer.json
git add composer.json
git commit -m "add composer.json for PHP app detection"

If you also have files from other frameworks or languages that could trigger another buildpack to detect your application as one of its own, e.g. a package.json which might cause your code to be detected as a Node.js application even if it is a PHP application, then you need to manually set your application to use this buildpack:

heroku buildpacks:set gerardbalaoro/php-laravel

The gerardbalaoro/php-laravel buildpack from the Heroku Registry represents the latest stable version of the buildpack. If you'd like to use the code from this Github repository, you can set your buildpack to the Github URL:

heroku buildpacks:set https://github.com/GerardBalaoro/heroku-buildpack-laravel.git

Please refer to Dev Center for further usage instructions.

Environment Variables

The buildpack will replace the existing .env file using variables from your Heroku Config Vars.

Generic Variables

The buildpack will recognize the APP_, DB_, and MAIL_ variables set in Heroku.

# Adds APP_NAME="Laravel App" to .env file
heroku config:set APP_NAME="Laravel App"

The following are the supported application variables:

  • APP_NAME
  • APP_ENV
  • APP_DEBUG
  • APP_URL

For database configuration variables:

  • DB_CONN (Database Driver)
  • DB_HOST
  • DB_PORT
  • DB_USER
  • DB_PASS
  • DB_NAME (Database Name)

For email configuration variables:

  • MAIL_DRIVER
  • MAIL_HOST
  • MAIL_USER
  • MAIL_PASS
  • MAIL_PORT

Additional Variables

For environment variables not metioned above, define them in the config variable LARAVEL_ENV_VARS and it will automatically be appended to the .env file.

# Adds BROADCAST_DRIVER=log to .env file
heroku config:set LARAVEL_ENV_VARS=BROADCAST_DRIVER=log

Unfortunately, the heroku config:set command only works for single-line strings, for multiple environment variables, set them at your Heroku application dashboard under the settings tab.

Set Laravel Environment Variables

Laravel Commands

The buildpack automatically runs the following artisan commands:

php artisan key:generate
php artisan view:clear

To run additional commands, set assign them to the config variable LARAVEL_COMMANDS

# Executes php artisan migrate and php artisan db:seed
heroku config:set LARAVEL_COMMANDS=php artisan migrate && php artisan db:seed

HTTP Basic Authentication

This will generate an .htpasswd file based on the config variable HT_AUTH

# Executes htpasswd -cb .htpasswd {username} {password}
heroku config:set HT_AUTH={username} {password}

It will also append the authentication code in public/.htaccess

AuthType Basic
AuthName "Restricted Access"
AuthUserFile /app/.htpasswd
Require valid-user

heroku-buildpack-laravel's People

Contributors

ddollar avatar deguif avatar dzuelke avatar fdr avatar gerardbalaoro avatar hone avatar janneaalto avatar jdinartejesus avatar jkutner avatar kennethreitz avatar martijngastkemper avatar mattgraham avatar maxehmookau avatar md-5 avatar mdz avatar mmcgrana avatar phansys avatar ptarjan avatar ryanbrainard avatar stesie avatar stof avatar technomancy avatar tmaher avatar tt 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.