Skip to content

PHP Application Skeleton: 5 Folders That Stay Put

4 min read Notes

PHP Application Skeleton: 5 Folders That Stay Put

A framework answers how the code runs. It does not answer where a controller lives in this project, who writes the migration for users, or which file holds the queue config. A php application skeleton is that answer, shipped as a repository you can install.

Code: Atomic-Framework-Application, GPL-3.0-or-later.

composer create-project globus-studio/atomic-framework-application myapp
cd myapp
cp .env.example .env
php atomic init/key
php -S localhost:8000 -t public

Five directories carry the contract, and the rest follow from them.

app/ and bootstrap/

app/ holds the application: controllers under Http/Controllers, middleware under Http/Middleware, models under Http/Models, and the user provider under Auth. A developer who knows Symfony or Laravel finds the layout familiar within a minute, which is worth more than a clever structure nobody can guess.

bootstrap/ holds constants, the config loader and error handling. The entry point stays thin, and the application-specific wiring lives in a provider, so a framework upgrade touches one file rather than every controller.

config/ and routes/

config/ splits by concern: database, cache, mail, auth, queue. Each file returns an array, so a deployment can read the difference between environments without a parser.

routes/ splits by request type: web.php, api.php, cli.php. A CLI command registered in cli.php cannot answer an HTTP request, and an API route does not pay for session middleware. That separation is the part people skip when they put everything in one file, and it is the part that prevents a route from being reachable by the wrong client.

public/ and storage/

public/ is the only directory a web server should serve. It holds the entry point, themes and uploads; everything else stays outside the document root, which is the difference between a misconfiguration and a data breach.

storage/ holds logs, cache and sessions. The directory must be writable by the PHP user and unreadable from the web, and the skeleton states that in the readme instead of leaving it to the first deploy.

database/ and resources/

Migrations and seeds live in database/, templates in resources/. Both are plain files, so a code review shows a schema change as a diff rather than as a database dump from a staging server.

The auth slice is the calibration

The skeleton ships three controllers: the landing page, a dashboard behind Authenticate, and one for login, register and logout. The User model has uuid, email, password and role, the provider reads users from the database, and the users table has a migration.

A stub would prove the wiring compiles. A working slice proves the whole vertical: routing, middleware, session, model, migration, template. When the first real feature arrives, the team is editing code that already runs.

Requirements and commands

PHP 8.1 with json, session, mbstring, fileinfo, pdo, pdo_mysql, curl; MySQL or MariaDB; Redis recommended for cache, queues, sessions and WebSockets; Composer. The readme lists them because a missing extension is the most common first deploy failure.

php atomic routes prints what is registered, php atomic migrations/migrate applies the schema, php atomic queue/worker runs the queue, php atomic schedule/run executes due tasks, php atomic init scaffolds a missing structure.

What the skeleton leaves to you

No admin generator, no CRUD screens, no page builder, and no opinion about CSS. Migrations stay hand-written, so a column rename is a file with a timestamp and a rollback rather than a diff from models.

That is a deliberate floor, not a ceiling: the skeleton is the smallest thing that runs in production, and every addition after that is a decision the project makes with its own evidence.

Related: modular php framework for the five layers underneath, and native file input for the same argument about native parts over generated ones.

Custom work

Need an API that does not exist yet?

Describe the task and the response format. We will estimate the endpoint, the integration and the maintenance.

Start a conversation