Laravel BASIC

The BASIC framework for web artisans who number their lines in tens.
Elegant syntax. Expressive GOTOs. Zero local variables.

github.com/dcarrero/laravel-basic

10 PRINT "WHAT IS THIS"

This is satire. It is also real: it serves HTTP, routes requests, renders templates, escapes output, reads a database and answers JSON. Written in BASIC. On purpose. Not affiliated with, endorsed by or a threat to Laravel.

BASIC cannot open sockets. Neither could your Commodore 64. So socat listens, a 100-line bash adapter does the HTTP part, and bwBASIC does everything else: routing, controllers, templates, escaping, URL decoding, CSV parsing and JSON.

How a request travels. No PHP was involved.

20 GOSUB ROUTES

Routes are DATA statements. Order is priority.

10000 REM @range 10000-14999
10010 DATA "GET", "/", 20000
10020 DATA "GET", "/users", 21000
10030 DATA "GET", "/users/{id}", 21100
10040 DATA "GET", "/hello", 22000
10050 DATA "GET", "/goto", 23000

BASIC cannot GOSUB to a variable, so gosubtisan build writes the dispatcher for you. That is the entire service container:

9000 REM DISPATCHER. GENERATED BY GOSUBTISAN BUILD. DO NOT EDIT. WE MEAN IT.
9010 ON RTN GOSUB 20000,21000,21100,22000,23000,21300,21200
Laravel compared with Laravel BASIC
Laravel (PHP)Laravel BASIC
Controller dispatchReflection + containerON RTN GOSUB
Dependency injectionService containerEvery variable is global, so everything is already injected
NamespacesPSR-4Line number ranges
ORMEloquentGOTOquent (CSV files)
CLIartisangosubtisan
QueuesHorizon10 GOTO 10

30 GOSUB SCREENSHOTS

Real screenshots. Served by bash, socat and a BASIC interpreter. No PHP was harmed.

Laravel BASIC welcome page: a Commodore 64 style screen that says LOAD LARAVEL,8,1 and lists 0 local variables
GET / . The welcome page.
GET /users: a table of eight users and their first computers
GET /users . GOTOquent reads a CSV.
GET /users/3: Amy Strad, Amstrad CPC 464, coding since 1984
GET /users/3 . Route model binding, manually bound.
GET /hello with a script tag in the name: the tag is printed as harmless text
GET /hello?name=<script> . Escaped at line 3500, by hand.
GET /users/999: ?UNDEF'D STATEMENT ERROR IN 404
GET /users/999 . ?UNDEF'D STATEMENT ERROR IN 404.
Browsing Laravel BASIC: home, users list, one user and the 404 page
Six seconds, four routes, zero local variables.

40 RUN

No clone, no build, just pull (amd64 and arm64, from the GitHub Container Registry):

docker run --rm -p 8000:8000 ghcr.io/dcarrero/laravel-basic
# open http://localhost:8000

Docker Compose (recommended, read-only and all):

git clone https://github.com/dcarrero/laravel-basic.git
cd laravel-basic
docker compose up --build
# open http://localhost:8000

The container runs as a non-root user, with a read-only filesystem, no capabilities and a healthcheck that asks ARE YOU ALIVE? every 30 seconds.

Bare metal (Debian/Ubuntu):

sudo apt install bwbasic socat
cp .env.example .env
./gosubtisan serve
docker compose ps shows the container healthy; curl shows the security headers; the log shows real requests
Healthy, read-only, and logging to a tmpfs it actually owns.

50 GOSUB GOSUBTISAN

$ ./gosubtisan route:list
METHOD  URI                    ACTION (LINE)
GET     /                      GOSUB 20000  WelcomeController.BAS
GET     /users                 GOSUB 21000  UserController.BAS
GET     /users/{id}            GOSUB 21100  UserController.BAS
GET     /hello                 GOSUB 22000  HelloController.BAS
GET     /goto                  GOSUB 23000  GotoController.BAS
GET     /api/users             GOSUB 21300  UserController.BAS
GET     /api/users/{id}        GOSUB 21200  UserController.BAS
./gosubtisan route:list and ./gosubtisan test: 14 passed, 0 failed, READY.
14 passed, 0 failed. Tested with curl and grep.

60 LIST DOCS

The long versions, for people who read manuals (all four of you):

70 PRINT "AS SEEN IN"

No journalists were harmed. One GOTO was.

80 DATA SPONSORS

Brought to you by people and projects that take technology more seriously than this repo does:

90 REM AUTHOR

Made by David Carrero Fernández-Baillo, who wrote his first 10 PRINT long before the web existed. Read more about tech, cloud and the occasional bad idea like this one on his blog, carrero.es (Spanish).