Download the PHP package bear/query-repository-graph without Composer
On this page you can find all versions of the php package bear/query-repository-graph. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bear/query-repository-graph
More information about bear/query-repository-graph
Files in bear/query-repository-graph
Package query-repository-graph
Short Description Static analysis of the cache graph that BEAR.QueryRepository attributes declare
License MIT
Homepage https://github.com/bearsunday/BEAR.QueryRepositoryGraph
Informations about the package query-repository-graph
BEAR.QueryRepositoryGraph
Static analysis of the cache graph that BEAR.QueryRepository
attributes declare. qr-graph reads the declarations without running the application: what each resource embeds,
what each write refreshes and purges, and what an invalidation reaches.
Installation
Usage
Run it from the application root.
People read the picture, impact and snapshot. Tools and AI agents read dump, impact --json and observe:
JSONL, described by the JSON Schemas. Each command and its limits are in
docs/graph.md. The picture above is php bin/qr-graph dot --dir=demo/src/Resource, run on
demo: resource classes that carry their attributes and nothing else.
Reading the picture
| grey rounded box | a page resource; pages nothing points to, where a request starts, line up on the left |
| plain text | any other resource (app); a host other than self is shown, as in app://blog |
| second row | the scheme and the cache as declared: cacheable, ttl: short, cacheable view, ttl: …, cacheable response, donut cache; nothing when the resource is not cached |
| black arrow | embeds, labelled with the relation (index embeds ranking as ranking) |
| grey arrow | #[DependsOn] |
| blue arrow | a write that refreshes or purges, labelled onPut refresh, onPost purge |
Arrows point the way they are declared. Invalidation travels against them: refreshing article reaches ranking
through its grey arrow, and index through the black one.
qr-graph html > graph.html writes the cached part of the picture (dot --cached) as one page; the whole graph is
qr-graph dot | dot -Tsvg. Click a resource: what invalidates it glows green, the writes that invalidate it blue, and
what it invalidates orange, each side counted; the rest dims. Below the picture, a collapsed Warnings section lists
the declarations that affect no cache, each with its file:line (a PhpStorm link with --editor=phpstorm), and a
collapsed Not drawn after it lists the resources left out.
What a change reaches
Each line is reached from the line above it at one less indent, by the relation in parentheses, and shows its
cache. A resource two paths reach is listed once, under a shortest one. app://self/login alone means a change to
it reaches nothing.
The snapshot as the source of truth
snapshot writes such a tree for every resource and every write. Keep it in the repository and check it in CI:
The demo keeps CI.
The runtime acts on the declarations; people and agents read and agree on the snapshot; CI keeps the two equal, as
composer.lock follows composer.json. A pull request that changes what a write invalidates shows it as a diff of
this file. Design the cache before the code the same way:
- Write the resource classes with their attributes only, as in demo.
- Agree on the picture and the snapshot, and commit the snapshot.
- Write the methods. The snapshot does not change.
Only declarations reach the graph. Invalidation written as code, a purge() call or a surrogate key set by hand,
never shows in the snapshot, so it cannot produce the tree that was agreed: what the cache does stays declared.
All versions of query-repository-graph with dependencies
ext-tokenizer Version *
composer-runtime-api Version ^2.0
bear/query-repository Version ^1.20.2
bear/resource Version ^1.34.2