Alpha
Alpha
AlphaBeta: when quoting is solved

Getting Started

Installation

Meet Laravel Bash

Laravel Bash is a web application framework with expressive, elegant syntax, as long as your idea of elegant includes "${@:2}". It gives you routing, controllers, an ORM, templates, validation, queues, events, broadcasting and a task scheduler, built from the small Linux programs that are already on your server.

Why Laravel Bash?

Creating a Laravel Bash Application

Installing Docker

Laravel Bash needs GNU tools and Bash 5.1 or later. macOS ships BSD tools and Bash 3.2, so Laravel Bash runs in Docker with Sail. Install Docker Desktop or OrbStack first.

Creating the application

git clone https://github.com/mrstebo/laravel-bash.git example-app
cd example-app
cp .env.example .env
./sail up -d
./sail artisan migrate --seed

Then open localhost:8000. The container runs ./artisan dev, which starts the web server, four queue workers, the event listener and the scheduler, so the examples work straight away.

note

There is no Composer. There is no installer. There is git clone, which is how all software was installed before 2012.

Initial Configuration

Configuration lives in .env, which is loaded line by line when the framework boots:

APP_NAME="Laravel Bash"
APP_ENV=local
APP_DEBUG=true

DB_CONNECTION=sqlite

QUEUE_WORKER_SLEEP=0.5
QUEUE_JOB_TIMEOUT=60

Read a value anywhere with config:

config APP_NAME              # Laravel Bash
config MAIL_MAILER log       # log, the default

Why not source .env?

The obvious way to load a .env file in Bash is set -a; source .env; set +a. That runs your .env file as code, so APP_NAME=$(rm -rf ~) does exactly what it says. It also overrides real environment variables, which phpdotenv doesn't do.

So env::load reads the file one line at a time, matches each line against ^([A-Z_][A-Z0-9_]*)=(.*)$, strips the quotes and comments, and only exports a key if it isn't already set. Real environment variables win, so this works:

DB_CONNECTION=pgsql ./sail artisan migrate

Databases

SQLite is the default, like Laravel 11 and later. Set DB_CONNECTION=pgsql to use the Postgres container that Sail starts. See Database: Getting Started.

Next Steps

Read about the request lifecycle to see what actually happens when a browser asks for a page, then the binaries that make it all work.