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 code
git clone https://github.com/nanobox-quickstarts/nanobox-laravel.git
# cd into the laravel app
cd nanobox-laravel
# 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
Visit your app at laravel.local
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
When Nanobox starts, it will run the quickstart install script as part of the build process which does the following:
- Downloads the Laravel Installer
- Installs the latest version of Laravel
- Updates database credentials in the
.env
file with environment variables auto-generated by Nanobox - Creates a
.env.prod
for use in a live app
For the full details, take a look at quickstart/install.sh
.
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.
For more details about running laravel apps with nanobox visit guides.nanobox.io/php/laravel/