Skip to content

nanobox-quickstarts/nanobox-laravel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

47 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Laravel with Nanobox

This is a Laravel quickstart provided by Nanobox that will generate a brand new Laravel project and configure it for Nanobox. To run the quickstart locally, download and install Nanobox.

Clone the Repo

# clone the code
git clone https://github.com/nanobox-quickstarts/nanobox-laravel.git

# cd into the laravel app
cd nanobox-laravel

Run the Quickstart

# Add a convenient way to access your app from the browser
nanobox dns add local laravel.local

# Run laravel as you would normally, with Nanobox
nanobox run php-server

Check it Out

Visit your app at laravel.local

Explore

With Nanobox, you don't have to have anything installed on your machine to run your app:

# drop into a Nanobox console
nanobox run

# where laravel is installed,
php -v

# your packages are available,
composer show

# and your code is mounted
ls

What Does This Quickstart Do?

When Nanobox starts, it will run the quickstart install script as part of the build process which does the following:

  1. Downloads the Laravel Installer
  2. Installs the latest version of Laravel
  3. Updates database credentials in the .env file with environment variables auto-generated by Nanobox
  4. Creates a .env.prod for use in a live app

For the full details, take a look at quickstart/install.sh.

Using Other Databases

By default, the quickstart only provides a MySQL database but configs for Postgres and Redis are both included in the boxfile.yml. To use add either one to your app, uncomment the entries in your boxfile.yml. If using Postgres, be sure to update the following in your .env and .env.prod.

DB_CONNECTION=pgsql
DB_HOST=$DATA_POSTGRES_HOST
DB_PORT=5432
DB_DATABASE=gonano
DB_USERNAME=$DATA_POSTGRES_USER
DB_PASSWORD=$DATA_POSTGRES_PASS

Run nanobox run to rebuild your app with the new data components.

Now What?

For more details about running laravel apps with nanobox visit guides.nanobox.io/php/laravel/