Loom
Pragmatic Zero Magic.
A PHP framework for content-driven applications.
Pages in files. Dependencies in plain sight.
01 File-native content
A page is a file.
Put it in a folder. Commit it. Move it with the rest of your project.
The path becomes the URL. A content site needs no database.
content/pages/notes/hello.vlt---
title: Hello, Loom
status: published
---
@html
<h1>Hello, Loom.</h1>
<p>A page. A file. Yours.</p>
/notes/helloHello, Loom.
A page. A file. Yours.
.vlt or Markdown. YAML frontmatter. Layouts and partials when you need them.
This website runs on Loom. You're looking at the result.
02 An explicit runtime
See the wiring.
A service is bound.
A dependency is passed.
A request gets a response.
Bindings live in the bootstrap. Dependencies arrive through constructors. Routes and middleware are declared in code.
The path from a request to a response stays visible in your code.
Read the actual bootstrapbootstrap/app.php// Explicit binding.
$app->singleton('content.driver',
function () use ($app) {
return new FileDriver(
$app->make(ContentParser::class),
$app->make(PageIndex::class),
$app->make(PageIndexer::class),
config('content.drivers.file.path',
content_path('pages')),
);
}
);
// An interface points to that binding.
$app->alias('content.driver',
ContentDriver::class);
The size of the runtime
- PHP source
- 576 KiB
- Direct Composer packages
- 4
163 PHP files under src/, excluding scaffold stubs. Uncompressed source; vendor packages are separate. Measured 18 October 2026.
- symfony/yaml
- composer/semver
- psr/log
- psr/container
PHP ^8.4. Markdown parsers are optional dependencies.
03 Beyond the page
Room to build.
Content, application logic, and the tools to run it. Fourteen parts of the framework, all included in the runtime.
01Content & viewsFiles / templates
File-native pages in .vlt or Markdown, with YAML frontmatter and folder-based URLs. A compiled view engine provides layouts, sections, partials, stacks, and custom directives.
- UUIDv7 page identities; JSON or SQLite page indexes.
- HTML and component content blocks; namespaced views and escaped template output.
- Markdown parsing through an optional CommonMark or Parsedown package.
02Container & eventsExplicit bindings
Bind factories, singletons, existing instances, and aliases. Dependencies are resolved through constructors; service providers register and boot application services.
- Configuration namespaces, environment values, and config caching.
- Event listeners, dispatch, and listener removal.
- The container implements the PSR-11 interface.
03Routing & middlewareHTTP lifecycle
Named routes, HTTP methods, route groups, optional parameters, and wildcard paths. Controller methods and callables run through declared middleware pipelines.
- URL generation from route names and parameters.
- Global, group, and per-route middleware; compiled route caching.
- Request and response objects; ETag response caching and exception handling.
04Database & ORMModels / queries
Models with attribute casts, mass-assignment controls, timestamps, soft deletes, scopes, and lifecycle events. Relations cover one-to-one, one-to-many, inverse, and many-to-many relationships.
- Lazy and eager loading; pivot operations.
- Query builder with joins, grouping, raw expressions, pagination, upsert, and query caching.
- SQLite, MySQL, and PostgreSQL through PDO.
05Schema & migrationsVersioned changes
A schema builder expresses tables, columns, indexes, and foreign keys. Database-specific grammars generate the SQL; a migration repository records which changes have run.
- PHP migrations and SQL migration files, with driver-specific variants.
- Separate schema grammars for SQLite, MySQL, and PostgreSQL.
- Tenant migration orchestration with batches and resume checkpoints.
06Multi-tenancyScoped resources
Resolve a tenant from the host, a path segment, or a callback. Content, views, storage, cache, sessions, and database connections scope to the active tenant.
- Tenant context and discovery.
- CLI targeting with
--tenantand--all-tenants. - Tenant-aware module artifacts and provisioning.
07ModulesManifest-driven
A module.json declares dependencies, routes, views, and CLI commands. Semantic version requirements and topological load order keep module relationships explicit.
- Namespaced module views and registered routes.
- Enable, disable, inspect, compile, and provision modules from the CLI.
- A base module contract and module lifecycle.
08ValidationRules / extensions
A standalone validator checks input against declared rules and returns validated fields. Validation failures raise an exception containing the collected errors.
- Required fields; numeric, integer, boolean, array, and date checks.
- Email, URL, size limits, allowed values, regular expressions, and field comparisons.
- A registry for custom validation extensions.
09Sessions & protectionState / request checks
Session middleware starts application sessions. The session manager handles stored values, flash data, session ID regeneration, and CSRF tokens.
- CSRF middleware for state-changing requests.
- Named rate limiters, dynamic limits, and IP allowlists.
- Escaped template output and parameter binding in database queries.
10HTTP clientOutbound requests
A cURL-backed client sends GET, POST, PUT, PATCH, and DELETE requests. Configure a base URL, default headers, connection timeouts, and request timeouts.
- Query parameters, authentication, and request body options.
- Retries with exponential backoff.
- Response objects expose status, headers, and decoded JSON. Requires the optional
curlextension.
11Queues & workersBackground jobs
Dispatch jobs synchronously or through a database queue. Named queues, delayed dispatch, retry handling, and unique-job contracts cover work outside the request.
- Pending dispatch and job serialization.
- Failure callbacks and deduplication.
- Worker options for memory, timeout, sleep, queue, and maximum job count.
12SchedulerRecurring work
Schedule callbacks or CLI commands. Tasks provide minute, hourly, daily, and specified-time schedules; the scheduler selects the work that is due.
- Run due tasks with
schedule:run. - Optional web cron endpoint.
- Web cron token checks, optional signed requests, IP allowlists, and rate limiting.
13Cache & storageDrivers / local disks
File, Redis, and APCu cache drivers share a cache contract. Storage uses named disks through a filesystem interface, with a local driver included.
- Cache TTLs, remember operations, and tag-based invalidation.
- Read, write, delete, list, and inspect local files.
- File and database data stores, plus an auto-selecting store for modules.
14CLI & diagnosticsDay-to-day operations
Scaffold models, controllers, middleware, modules, and console commands. Manage pages, configuration, modules, routes, caches, migrations, workers, and schedules from the same CLI.
- Installation, development server, diagnostics, and optimization commands.
- Page creation, publication, deletion, listing, and index rebuilding.
- PSR-3 file logging with daily rotation.
./loom listshows available commands.
04 Get Loom
Make something
with it.
git clone https://github.com/anvyr/loom.git
cd loom
./install.sh
./loom serve
Open http://localhost:8000.
composer require anvyr/loom:^1.0
Bring the runtime into your PHP project.
PHP 8.4+ · Composer · Linux, macOS, or WSL2
Extensions: pdo, mbstring, json, openssl. Optional: curl, redis, apcu.
Built by Anvyr. Open under Apache 2.0.