PHPackages                             lofye/foundry-framework - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. lofye/foundry-framework

ActiveLibrary[Framework](/categories/framework)

lofye/foundry-framework
=======================

Foundry: an explicit, LLM-first PHP web framework

v0.8.0(3w ago)17MITPHPPHP ^8.4CI failing

Since Mar 6Pushed 3w ago1 watchersCompare

[ Source](https://github.com/lofye/foundry-framework)[ Packagist](https://packagist.org/packages/lofye/foundry-framework)[ RSS](/packages/lofye-foundry-framework/feed)WikiDiscussions main Synced 3w ago

READMEChangelogDependencies (25)Versions (15)Used By (0)

Foundry Framework
=================

[](#foundry-framework)

Foundry is a production-minded, explicit, deterministic, LLM-first PHP framework for building feature-local web apps. Visit [FoundryFramework.org](https://foundryframework.org) for extensive documentation.

Core Foundry remains MIT-licensed and fully usable without restriction. Explain, generate, diagnostics, trace analysis, and graph diffing remain available without a license. The monetization system is opt-in, local-first, and isolated from core compile, inspect, verify, scaffold, and runtime flows.

It is optimized for:

- explicit contracts
- deterministic generation
- machine-readable inspection
- small safe edit surfaces
- strong verification and testing

Getting Started
---------------

[](#getting-started)

Run:

```
foundry
```

Foundry behaves deterministically:

- in an empty directory, it offers curated onboarding examples
- in an existing Foundry project, it inspects the current project
- `foundry explain` with no target explains the first feature or route deterministically

For meaningful framework-module work, canonical context lives in:

- `Modules//.spec.md`
- `Modules//.md`
- `Modules//.decisions.md`

These paths mean:

- `Modules//.spec.md` → authoritative module intent
- `Modules//.md` → current state
- `Modules//.decisions.md` → append-only decision history
- Keep module decision ledgers append-only; do not compact historical entries. Summarize accumulated decisions in a `## Decision Summary` section inside `Modules//.md`.
- `Modules//specs/*.md` → execution specs (planning artifacts, non-authoritative after implementation)
- `Modules//specs/drafts/*.md` → draft execution specs (non-executable planning artifacts)
- `Modules//outcomes/*.md` → implementation reconstruction notes (post-implementation artifacts)
- `Modules/implementation.log` → completed framework execution-spec ledger
- Framework implementation-log `- spec:` entries must use canonical module spec paths (`Modules//specs/-.md`), not slug aliases.

For downstream application feature work, use:

- `Features//.spec.md`
- `Features//.md`
- `Features//.decisions.md`

For completed active framework execution specs, create or update the matching reconstruction note before reporting completion. Reconstruction notes describe what actually changed, not speculative implementation plans.

Execution spec IDs are ordered contracts within each feature. IDs must remain contiguous at every hierarchy level (`001`, `002`, `003`; `007.001`, `007.002`, ...), skipping numbers is forbidden, and agents must stop instead of planning, implementing, promoting, or logging specs when any numeric gap exists.

Use `foundry verify context --feature= --json` as the primary machine-readable proceed/fail gate. If canonical context is missing, create it first with `foundry context init  --json`. If context verification fails, repair context before implementation.

Modules vs Features
-------------------

[](#modules-vs-features)

Foundry framework capabilities are governed as Framework Modules under `Modules/`. Downstream business/application capabilities are governed as Application Features under `Features/`. Framework internals may remain layer-organized under `src/*`.

### Reconstruction Notes

[](#reconstruction-notes)

Foundry stores implementation reconstruction notes in each module's `plans/` directory.

Specs define what must be true. Decision ledgers explain why architectural choices were made. Implementation logs record that a spec was completed. Reconstruction notes explain how the spec was actually implemented.

This gives future agents and developers enough context to resume work, audit behavior, or rebuild a module without relying on chat history.

Example:

```
Modules/Marketplace/specs/003-marketplace-entitlements-and-license-activation.md
Modules/Marketplace/outcomes/003-marketplace-entitlements-and-license-activation.md

```

For framework modules, completed specs are expected to have matching reconstruction notes.

Feature-Localized Layout
------------------------

[](#feature-localized-layout)

Foundry features are moving toward a localized structure where the feature directory is the primary context unit for LLMs:

```
Features/
  README.md

  /
    .spec.md
    .md
    .decisions.md
    specs/
    plans/
    docs/
    src/
    tests/

```

Feature-specific runtime code and tests should live inside the owning feature directory once the localized feature layout is enabled. Shared framework files should contain registration glue only.

Use boundary verification when available:

```
foundry verify features --json
foundry feature:map --feature= --json
```

Framework documentation under `docs/` is canonical public documentation and is consumed by the foundryframework.org website. Application feature context belongs under `Features//`, not `docs/features//`; feature runtime code belongs under `Features//src/`.

Shell Completion
----------------

[](#shell-completion)

Foundry can emit deterministic completion scripts for bash and zsh:

```
foundry completion bash
foundry completion zsh
```

Static completion comes from the registered CLI surface, so command and subcommand suggestions stay aligned with `help --json` and CLI surface verification.

When completing `foundry implement spec  `, names and ids resolve from active execution specs, preferring canonical module/feature roots (`Modules/*/specs` and `Features/*/specs`) with legacy compatibility where applicable. Draft specs are excluded by default.

Install And First Run (Packagist)
---------------------------------

[](#install-and-first-run-packagist)

```
composer require lofye/foundry-framework
foundry

# or, for automation:
foundry init --example=blog-api
foundry new my-foundry-app --starter=standard --json
cd my-foundry-app
composer install

foundry
foundry explain --json
foundry compile graph --json
foundry inspect graph --json
foundry inspect pipeline --json
foundry doctor --json
foundry verify graph --json
foundry verify pipeline --json
foundry verify contracts --json
php -S 127.0.0.1:8000 public/index.php
```

Core Workflow for LLMs
----------------------

[](#core-workflow-for-llms)

1. Read the canonical feature spec, state document, and decision ledger.
2. Run `foundry verify context --feature= --json`.
3. Repair context first if verification fails.
4. Make the smallest necessary source-of-truth changes.
5. Re-run verification and tests.

Clarification: `feature-alignment-pass` is a skill/workflow name, not a Foundry CLI command. Use `./foundry verify context --json` as the canonical CLI command for context/alignment validation.

When claiming implementation completion, use this canonical machine gate:

```
php vendor/bin/phpunit
bin/phpunit-coverage --coverage-clover build/coverage/clover.xml
./foundry verify coverage --min=90 --clover=build/coverage/clover.xml --json
```

Reference Pointers
------------------

[](#reference-pointers)

For deeper architecture walkthroughs, use `foundry explain  --deep --markdown --json`. The explain system composes `ExplainContribution` sections through the contributor registry and related docs.

Browse runnable examples in `docs/example-applications.md` and `examples/README.md`.

Use `AGENTS.md` for the full contributor and agent workflow.

###  Health Score

42

—

FairBetter than 89% of packages

Maintenance95

Actively maintained with recent releases

Popularity7

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~7 days

Recently: every ~16 days

Total

13

Last Release

24d ago

PHP version history (2 changes)v0.1.0PHP ^8.5

v0.2.1PHP ^8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/81647167603b91be4eb9cbb77f4dd59704b1dfb7d00095a03de01fafb8716486?d=identicon)[lo\_fye](/maintainers/lo_fye)

---

Top Contributors

[![lofye](https://avatars.githubusercontent.com/u/56428?v=4)](https://github.com/lofye "lofye (204 commits)")

---

Tags

llmphp84webframework

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lofye-foundry-framework/health.svg)

```
[![Health](https://phpackages.com/badges/lofye-foundry-framework/health.svg)](https://phpackages.com/packages/lofye-foundry-framework)
```

###  Alternatives

[laravel/sail

Docker files for running a basic Laravel application.

1.9k199.2M1.2k](/packages/laravel-sail)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k12](/packages/tempest-framework)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19564.8M1.6k](/packages/drupal-core)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[getkirby/cms

The Kirby core

1.5k567.4k433](/packages/getkirby-cms)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
