Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Docs check

# Checks the docs on every pull request into staging and master.

on:
pull_request:
branches: [staging, master]
workflow_dispatch:

permissions:
contents: read

jobs:
summary:
name: SUMMARY.md matches the pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 22

- name: Check SUMMARY.md
run: node scripts/check-summary.mjs

links:
name: Links and anchors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Check the links between the pages
uses: lycheeverse/[email protected]
with:
lycheeVersion: v0.24.2
args: --config lychee.toml README.md SUMMARY.md 'v3.0/**/*.md'
fail: true

markdown:
name: Markdown structure
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- uses: actions/setup-node@v7
with:
node-version: 22

- name: Check the Markdown rules
run: npx --yes [email protected]

wording:
name: Wording (warnings on added lines)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7

- name: Check the wording of the added lines
uses: errata-ai/[email protected]
with:
version: 3.28.1
files: README.md,SUMMARY.md,v3.0
separator: ","
sync: false
reporter: github-pr-annotations
filter_mode: added
fail_on_error: false
12 changes: 12 additions & 0 deletions .markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Markdown rules for the docs (https://github.com/DavidAnson/markdownlint).
// Run from the repository root: npx markdownlint-cli2
{
"config": {
"default": true,
// Paragraphs are written as one line each.
"MD013": false,
// Package pages repeat headings such as "Examples" under different sections.
"MD024": { "siblings_only": true }
},
"globs": ["README.md", "SUMMARY.md", "v3.0/**/*.md"]
}
16 changes: 16 additions & 0 deletions .vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Wording checks for the docs (https://vale.sh).
# Run from the repository root: vale README.md SUMMARY.md v3.0

StylesPath = .vale/styles
MinAlertLevel = suggestion
Vocab = Quantum

[*.md]
BasedOnStyles = Vale, Quantum
# The vocabulary lists both spellings of some names (JWT and the package Jwt), so it only feeds
# the spell check; Quantum.Names enforces the spelling of names.
Vale.Terms = NO

# The upgrade guide describes what changed, so it may say "previously" and "no longer".
[v3.0/upgrade-guide.md]
Quantum.History = NO
10 changes: 10 additions & 0 deletions .vale/styles/Quantum/Filler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
extends: existence
message: "Leave out '%s'."
level: warning
ignorecase: true
tokens:
- simply
- just
- easily
- obviously
- please
9 changes: 9 additions & 0 deletions .vale/styles/Quantum/History.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
extends: existence
message: "Describe the current behavior instead of its history ('%s'); the upgrade guide is the place for changes."
level: warning
ignorecase: true
tokens:
- previously
- no longer
- nowadays
- anymore
11 changes: 11 additions & 0 deletions .vale/styles/Quantum/Names.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extends: substitution
message: "Write '%s' instead of '%s'."
level: warning
ignorecase: false
swap:
QuantumPHP: Quantum
Github: GitHub
Phpunit: PHPUnit
phpunit: PHPUnit
Phpstan: PHPStan
phpstan: PHPStan
51 changes: 51 additions & 0 deletions .vale/styles/config/vocabularies/Quantum/accept.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[Aa]rgs
[Aa]utoload(ed|able)
[Aa]utowir(e|ing)
basename
bcmath
[Cc]allables?
[Cc]aptchas?
[Cc]hainable
[Cc]ryptor
[Cc]srf
datetime
debugbar
decryptable
[Dd]ocblocks?
DTOs?
falsey
fileinfo
fillable
gd
[Hh]asher
hCaptcha
HTTP
Http
Idiorm
[Ii]nstantiable
invokable
JWT
Jwt
lowercas(es|ing)
[Mm]emcached?
minifier
Monolog
multibyte
mutators
[Pp]aginators?
PHPDoc
PHPMailer
PHPStan
PHPUnit
preformatted
redis
rehydrates
reloadable
rethrow(n|ing)
simplexml
Symfony
[Tt]hrowables?
traversables
unpositioned
unserializ(e|ed|es|ation)
uppercased
26 changes: 18 additions & 8 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,27 @@ If you use a local Markdown preview tool/editor, verify heading hierarchy and li
- Use fenced code blocks with language hints (for example, ```bash).

## Testing Guidelines
There is no automated test suite in this repository. Minimum validation for each change:
The workflow `.github/workflows/docs-check.yml` checks every pull request into `staging` and `master`. Run the same checks locally before you push, from the repository root:

- Check internal links you edited.
- Confirm `SUMMARY.md` includes new/moved pages in the right section.
- Proofread for terminology consistency (`Quantum`, package names, command names like `qt`).
- `node scripts/check-summary.mjs`: every page `SUMMARY.md` links to exists, and every page under `v3.0` is listed in `SUMMARY.md`.
- `lychee --config lychee.toml README.md SUMMARY.md 'v3.0/**/*.md'`: links between the pages and the `#heading` anchors they point to. Links to other sites are not checked.
- `npx [email protected]`: the Markdown rules in `.markdownlint-cli2.jsonc` (heading order, code blocks with a language hint, blank lines and list markers), with the version CI uses; a newer version knows more rules and reports findings CI does not. `npx [email protected] --fix` repairs most findings.
- `vale README.md SUMMARY.md v3.0`: the wording rules in `.vale/styles/Quantum` (names such as `Quantum`, `GitHub` and `PHPUnit`, no history narration outside the upgrade guide, filler words) and the spell check. Add a correct word it does not know to `.vale/styles/config/vocabularies/Quantum/accept.txt`. On a pull request Vale only reports warnings on the lines the pull request adds.

The first three fail the pull request. Lychee and Vale are single programs from [lychee](https://github.com/lycheeverse/lychee/releases) and [Vale](https://github.com/errata-ai/vale/releases); `npx` downloads markdownlint-cli2 on first use.

The checks cannot tell whether a statement matches the framework code, so also:

- Check every statement and example name you add against the framework code.
- Confirm `SUMMARY.md` lists new or moved pages in the right section.

## Commit & Pull Request Guidelines
Recent history uses a conventional docs prefix:
The prefix says what a commit changes:

- `docs: <short description>` for the documentation itself: the pages under `v3.0`, `README.md` and `SUMMARY.md`. Example: `docs: complete Lang package docs for v3.0`.
- `chore: <short description>` for the tooling around it: the workflows in `.github`, `scripts`, the configs of the checks (`lychee.toml`, `.markdownlint-cli2.jsonc`, `.vale.ini`, `.vale`) and this file. Example: `chore: check links and anchors on pull requests`.

- Commit format: `docs: <short description>`
- Example: `docs: complete Lang package docs for v3.0`
A commit that changes pages only to satisfy a new check, in the same commit as the check, uses `chore:`.

For pull requests:

Expand All @@ -49,7 +59,7 @@ For pull requests:
## Git Workflow

1. Create a feature branch from `master` using `docs/<topic>` naming (examples in history: `docs/v3-package-loader`, `docs/summary-add-config-links`).
2. Use focused commits with `docs: ...` messages.
2. Use focused commits with `docs: ...` or `chore: ...` messages (see above).
3. Keep the branch current with `master` before merge (history includes both rebases and `Merge branch 'master' into docs/...`).
4. Open a PR targeting `master` with:
- scope summary
Expand Down
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

Quantum is a lightweight, high-performance PHP framework built with simplicity, modularity, and developer experience in mind. Designed for both beginners and professionals, it allows rapid development of web applications using a clean and expressive syntax.

[![](https://github.com/quantum-php/framework/actions/workflows/php.yml/badge.svg)](https://github.com/quantum-php/framework/actions/workflows/php.yml)[![](https://codecov.io/gh/quantum-php/framework/branch/master/graph/badge.svg)](https://codecov.io/gh/quantum-php/framework)[![](https://scrutinizer-ci.com/g/quantum-php/framework/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/quantum-php/framework)[![](https://img.shields.io/github/license/quantum-php/framework)](https://github.com/quantum-php/framework/blob/master/LICENSE)[![](https://img.shields.io/packagist/v/quantum/framework)](https://packagist.org/packages/quantum/framework)
[![Build](https://github.com/quantum-php/framework/actions/workflows/php.yml/badge.svg)](https://github.com/quantum-php/framework/actions/workflows/php.yml)[![Coverage](https://codecov.io/gh/quantum-php/framework/branch/master/graph/badge.svg)](https://codecov.io/gh/quantum-php/framework)[![Code quality](https://scrutinizer-ci.com/g/quantum-php/framework/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/quantum-php/framework)[![License](https://img.shields.io/github/license/quantum-php/framework)](https://github.com/quantum-php/framework/blob/master/LICENSE)[![Latest version](https://img.shields.io/packagist/v/quantum/framework)](https://packagist.org/packages/quantum/framework)
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fquantum-php%2Fdocs.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fquantum-php%2Fdocs?ref=badge_shield)
***

Expand Down Expand Up @@ -76,20 +76,20 @@ Quantum is a modern MVC/HMVC framework that provides the core tools needed to bu

### Features

* MVC & HMVC architecture
* Powerful routing with support for RESTful routes
* Built-in authentication & CSRF protection
* Modular structure with organized services and modules
* Environment-based configuration system
* Templating system with escaping and layout support
* File uploads, storage and file system abstraction
* Mailer integration
* Multiple database adapter support (Idiorm, SleekDB)
* Flexible caching system with multiple drivers (File, Database, Redis, Memcache)
* Simple and extendable testing setup
* Localization and translation support
* CLI tools for rapid scaffolding and dev tasks
* JWT support for APIs
- MVC & HMVC architecture
- Powerful routing with support for RESTful routes
- Built-in authentication & CSRF protection
- Modular structure with organized services and modules
- Environment-based configuration system
- Templating system with escaping and layout support
- File uploads, storage and file system abstraction
- Mailer integration
- Multiple database adapter support (Idiorm, SleekDB)
- Flexible caching system with multiple drivers (File, Database, Redis, Memcache)
- Simple and extendable testing setup
- Localization and translation support
- CLI tools for rapid scaffolding and dev tasks
- JWT support for APIs

***

Expand Down
11 changes: 10 additions & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@

## v3.0

### About Quantum

* [What is Quantum?](v3.0/introduction/what-is-quantum.md)
* [Why Quantum?](v3.0/introduction/why-quantum.md)

### Getting Started

* [Introduction](v3.0/getting-started/introduction.md)
* [Installation](v3.0/installation.md)
* [Quickstart](v3.0/getting-started/quickstart.md)
Expand All @@ -11,6 +17,7 @@
* [Upgrade Guide](v3.0/upgrade-guide.md)

### Core Concepts

* [Routing](v3.0/core-concepts/routing.md)
* [Request](v3.0/core-concepts/request.md)
* [Controllers](v3.0/core-concepts/controllers.md)
Expand All @@ -21,6 +28,7 @@
* [Modules](v3.0/core-concepts/modules.md)

### Advanced Features

* [Request Lifecycle](v3.0/advanced-features/request-lifecycle.md)
* [Configuration](v3.0/advanced-features/configuration.md)
* [Environment](v3.0/advanced-features/environment.md)
Expand All @@ -29,13 +37,15 @@
* [Dependency Injection](v3.0/advanced-features/dependency-injection.md)

### CLI

* [CLI Overview](v3.0/cli/overview.md)
* [The qt Command-Line Tool](v3.0/cli/qt-command-line-tool.md)
* [Development Server](v3.0/cli/development-server.md)
* [Code Generation](v3.0/cli/code-generation.md)
* [Console Commands](v3.0/cli/console-commands.md)

### Packages

* App
* [Overview](v3.0/packages/app/overview.md)
* [Architecture](v3.0/packages/app/architecture.md)
Expand Down Expand Up @@ -255,4 +265,3 @@
* [Contracts](v3.0/packages/view/contracts.md)
* [Helpers](v3.0/packages/view/helpers.md)
* [Usage](v3.0/packages/view/usage.md)

7 changes: 7 additions & 0 deletions lychee.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Link check for the docs (https://lychee.cli.rs).
# Checks the links between the pages and the headings they point to (#anchor).
# Links to other sites are skipped, so a slow site cannot fail a pull request.

offline = true
include_fragments = "anchor-only"
no_progress = true
43 changes: 43 additions & 0 deletions scripts/check-summary.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// Checks that SUMMARY.md and the pages under v3.0 match:
// every page SUMMARY.md links to exists, and every page under v3.0 is listed.
// SUMMARY.md drives the navigation of the website and GitBook, so a page it does not list
// cannot be reached from the sidebar.
//
// Run it from the repository root: node scripts/check-summary.mjs

import { readFileSync, existsSync, readdirSync, statSync } from 'node:fs';
import { join, normalize, sep } from 'node:path';

const toPosix = (path) => path.split(sep).join('/');

const listPages = (dir) => readdirSync(dir).flatMap((name) => {
const path = join(dir, name);

if (statSync(path).isDirectory()) {
return listPages(path);
}

return path.endsWith('.md') ? [toPosix(path)] : [];
});

const summary = readFileSync('SUMMARY.md', 'utf8');

const linked = [...summary.matchAll(/\]\(([^)#\s]+[.]md)(#[^)]*)?\)/g)]
.map((match) => toPosix(normalize(match[1])));

const missing = linked.filter((page) => !existsSync(page));
const unlisted = listPages('v3.0').filter((page) => !linked.includes(page));

for (const page of missing) {
console.log(`SUMMARY.md links to a page that does not exist: ${page}`);
}

for (const page of unlisted) {
console.log(`Page is not listed in SUMMARY.md: ${page}`);
}

if (missing.length > 0 || unlisted.length > 0) {
process.exit(1);
}

console.log(`SUMMARY.md lists all ${linked.length} pages, and every link points to an existing page.`);
4 changes: 1 addition & 3 deletions v3.0/advanced-features/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ The `Config` class loads configuration files described by a `Quantum\Config\Setu
## API Methods

- `load(Setup $setup)`: Load all configuration files.
- `import(Setup $setup)`: Import additional config files.
- `import(Setup $setup)`: Import additional config files.
- `importIfExists(Setup $setup)`: Import a config file only when it exists; returns `false` otherwise.
- *Note:* The `filename` defined in the `Setup` object is strictly used as the top-level key for the imported data. `Config::import()` always structures imported data as `[$fileName => $data]`. Empty or `null` filenames are not supported and will result in implicit namespacing under an empty or null key; always provide a unique, non-empty filename to ensure proper access and collision detection.
- `get(string $key, $default = null)`: Retrieve a config value.
Expand Down Expand Up @@ -97,5 +97,3 @@ After configuration fundamentals, continue with:
- [Environment](environment.md)
- [Dependency Injection](dependency-injection.md)
- [Modules](../core-concepts/modules.md)


Loading
Loading