Repository navigation
Releases
v0.10.0 — Working routes, partial updates and forms: fixes from the v0.9.0 audit
Highlights
An audit of v0.9.0 (issues #55–#98) found that the README quick start did not run, route middleware never executed, and state was lost in many ordinary setups. This release fixes 46 issues, makes actions work without an explicit session_start(), adds useFormAction, and runs usephp.js in a real browser on CI.
⚠️ Upgrade notes
- Run
./vendor/bin/usephp publishafter updating. The server andusephp.jschanged together, for example the new form markup,_usephp_snapshots[]and the restore signature. - Forms rendered before the deploy get a
400. Action signatures now cover the page path. Cached snapshot restores made by older pages also get a400, andusephp.jsdiscards that saved snapshot.
⚠️ Breaking changes
- Action forms are bound to their page (#56 → #107). A form can only be posted to the path it was rendered for. Hand-written forms use
signAction($instanceId, $json, $pagePath). HTML rendered on one route and inserted into another page gets a400; use a defer for that. Forms inside a defer are bound to the defer name and accepted on any page, where that page's guard still runs. - Route middleware now runs (#56 → #101). A guard that used to be ignored now applies to GET and to action POSTs. Defer endpoints are not covered, so a protected defer has to check permissions itself.
- Unresolvable components throw (#74, #111). An unregistered class as a route handler, or an unknown name given to
createElement()/render(), throwsLogicExceptioninstead of returning an empty result. A defer whose target is unregistered answers500instead of an empty200. Names that arrive from a request keep their400/404. - Event props (#75).
onFocus,onBlur,onLoadandonErrorthrow. Supported events areonClick,onChange,onInputandonSubmit. - Hook values (#93). Values carried by actions and snapshots must be null, scalars or arrays. Anything else throws when it is rendered.
- Component keys (#71). A fixed key combined with a props key becomes
row/k1, so those components no longer see their earlier state. - Nested defers (#59). An inner defer needs a registered endpoint.
srcdoc(#58). A non-empty value throws.- Generated markup (#77). Action buttons are
<button form="…">with a separate hidden form. CSS or scripts that relied on the old wrapping form need updating. style/scriptchildren are raw (#85). Do not put user input in them. A closing tag in the content throws.- PSX (#84). Built-in tags compile to
createElement(), so attribute order follows the source. Cached output is recompiled once.
Security fixes
- Route guards were never run (#56 → #101, #107). Includes the bypass of posting a guarded page's signed form to an unguarded URL, and of using
restoreto get a form signed for another page. - Session data in shared caches (#59 → #100, #109 → #114). Nested defers were inlined under the parent's public
Cache-Control. A public defer could also sendSet-Cookie, a CSRF token or a session-bound signature. Those responses are nowprivate, no-storewith a logged warning. javascript:block bypass (#57 → #99). Tabs and newlines inside a URL are removed before the check. Attribute and scheme checks ignore case.srcdocscripts ran (#58 → #99).- Malformed snapshots caused a 500 (#86 → #101).
?_snapshot[]=1hit every route. Invalid input is now a verification failure, and a bad POST is a400.
Added
useFormAction(['field' => $setter])(#76 → #105). Copies submitted fields intouseState. Which field goes to which hook is signed. The values are not signed, so treat them as untrusted input.- Element events (#75 → #105).
onClickon any element, plusonChange,onInput(300 ms debounce) andonSubmit. Without JavaScript, onlyonClickon buttons and submit or image inputs andonSubmitwork. - Arbitrary attributes on every
H::*tag (#94 → #105).H::div(title: 'x', role: 'alert'),H::button(...['aria-label' => 'x']). - Route middleware API (#56 → #101). Takes
(array $params, RequestContext $request). Returnnullortrueto continue,falsefor a 403, or a string orElementto answer with it.runRouteMiddleware()is available for custom front controllers.
Fixes
- Actions and partial updates (#104). No
session_start()needed (#55).fc()with Session or Memory updates in place (#78, #96). Class components keep Snapshot state on Session and Persistent routes (#63). Redirects keep the query string (#64).useRouter()['params']survives a partial update (#65). - Snapshots (#106). Session and Shared store one snapshot per instance, up to 64 (#67). A parent update keeps its children's state (#68). Isolated routes without JavaScript answer the POST directly, so state is kept (#69).
- Client (#103, #105, #106). Partial updates morph the DOM, so input, focus and selection survive (#79). A double click sends one POST (part of #80). Parent and child components update in turn, and fixed-value clicks made meanwhile are dropped.
- Hooks (#100, #116).
useEffectcleanup no longer crashes the session (#60, #61).setState(null)keeps null (#66). A parent's hooks stay with the parent after a child renders orrender()is nested (#70, #73, #112). Int keys work (#72). - Rendering (#99, #105). Nested children are flattened (#62). Invalid UTF-8 no longer empties text (#88).
aria-hidden={false}and similar attributes are kept (#95). A button inside an app's form no longer nests forms (#77). - Router (#101). Literal route text is escaped (#89). HEAD falls back to GET (#90). Parameters are decoded (#91).
- PSX (#102).
{/* comment */},{$x && <b/>},<style>and<script>compile correctly, and invalid output is a compile error (#81, #82). Entities are decoded (#83).{0}andwidth="100"work understrict_types(#84).usephp compileexits 1 on a missing path (#97).
Docs
- The README quick start now runs, and CI executes the README code (#98 → #108).
->name(),generate(),navigateandisActivewere removed from the docs because they never existed. - State sharing across route parameters is documented, with how to set keys (#92).
Tests
- 464 → 1211 PHPUnit tests, 6220 assertions. PHPStan and php-cs-fixer clean.
- New 79 Playwright tests for
usephp.jsrun on CI (#110 → #117).
Known limitations
- #80: with several tabs, the last write wins, and there is no
fn($prev)update. - #87: HTML size grows with the square of the row count when one state holds a whole list. Reported to exceed
memory_limit=128Mat 1000 rows.
Full Changelog: v0.9.0...v0.10.0
v0.9.0 — Security hardening: signed actions, session-bound snapshots, validated markup
Highlights
A security-hardening release. A server-side audit (issues #31, #37–#43, #49, #52, #53) and a client-script audit (#35) found that the browser could tamper with hook state, plant snapshots into other users' sessions, make the server execute arbitrary PHP functions through event props, and break out of tags via attribute names. All of them are fixed, the trust boundaries are documented, and the test suite now actually runs to completion.
⚠️ Breaking changes
- Actions are signed (#47). Every rendered action form carries
_usephp_action_sig, an HMAC over the instance id, the exact action JSON and the session id.doHandleAction()rejects any non-restoreaction without a valid signature. The key is the snapshot secret whensetSnapshotSecret()was called, otherwise a random per-session key. Apps with no secret and no PHP session now get400on every action until they callsetSnapshotSecret(). Custom form rendering and hand-written tests must callUsePHP::signAction($instanceId, $json). - Event props accept only
Actionor\Closure(#46).createElement()no longer runsis_callable()ononClick/onChange/ …; strings, arrays, invokable objects and ints throwInvalidArgumentException. TheH::*$on*parameters are narrowed toAction|\Closure|null. - Tag and attribute names are validated (#50). Tag names must match
[A-Za-z][A-Za-z0-9-]*, attribute names[A-Za-z_:][A-Za-z0-9:_.-]*, and any string prop namedon*(onclick,onerror,onLoadas a string) is refused. Violations throwRuntimeException.data-*,aria-*, SVG names,xlink:href,viewBox, custom elements all pass unchanged. - Failed partial submits are not replayed (#35). A non-2xx or thrown partial POST no longer falls back to
form.submit(). A cancelableusephp:submit-errorevent is dispatched and the component getsdata-usephp-error. setDeferPrefix()users must pass the same prefix torenderClientScript($src, $deferPrefix)(#35), which now emitswindow.usePHP.deferPrefix.session_regenerate_id()invalidates previously rendered action signatures and stored Session/Shared snapshots, same as the CSRF token.
Security fixes
- Client-writable hook state / storageType / instance id (#37, #41, #42 → #47).
Action::fromArray()validates every field's shape; malformed JSON is400 Invalid action datainstead of an uncaughtTypeError. Hook index is bounded to[0, 255],_usephp_componentmust contain#, be ≤ 255 bytes and carry no control characters, and the snapshot memo must name the posted instance. - Open redirect via
REQUEST_URI(#38 → #44). The post-action303 Locationis built bynormalizeRedirectPath(): exactly one leading/, no\, no query string, fallback to/on control characters.usephp.jsonly follows same-origin redirects. - Session snapshot injection (#39 → #48). Session/Shared snapshots are HMAC-bound to
session_id()viaSnapshotSerializer::withContext(). A?_snapshot=on a Session route is ignored and logged. The empty context is byte-identical to the old payload, so Persistent and plain Snapshot round trips are unchanged. - Session/Shared snapshots were never restored (#52, #53 → #54).
handleSnapshotRestoration()returned early without?_snapshot=, so Shared only restored by accident and Session state was write-only. Both now restore from$_SESSIONon every GET through the session-bound serializer. onClickstring callable executed (#40 → #46) and tag/attribute name injection (#31 → #50), see breaking changes above.- Client script (#35).
data-usephp-defer-urlis only hydrated when same-origin, under the defer prefix, andtext/html. Fragments containing a usePHP form, CSRF token or snapshot are never written tolocalStorageeven withDefer::$localCache.
Docs
- README (en/ja): new "What usePHP does not protect (trust boundaries)" section (#45), plus subsections for signed actions, the deferred fetch guard, non-replayed partial submits, tag/attribute validation, and the session binding of snapshots.
docs/: UsePHP decomposition design note (#36).
Tests
- The PRG redirect
exitindoHandleAction()used to kill the PHPUnit process silently with exit code 0, so roughly 80 tests never ran and CI stayed green (#49 → #51).UsePHP::withExitHandler()/withHeaderEmitter()are the test seams; the suite now completes. - 357 → 464 tests, 1122 assertions, all green. PHPStan and php-cs-fixer clean.
Full Changelog: v0.8.0...v0.9.0
v0.8.0 — fc() Snapshot partial updates + opt-in client-side snapshot persistence
Highlights
Two fixes for Snapshot-storage components, motivated by the /snapshot example counter that did not work: clicks were silently dropped, and even when they weren't, a reload reset the count.
fc() Snapshot components now get partial updates (#33)
handleAction() only answered partial (AJAX) requests for registry-registered class components. fc() function components always fell through to the PRG redirect, and on an Isolated route nothing carries a snapshot across that redirect — so the state change was lost.
The action handler now replays the page's GET route for partial requests targeting an unregistered Snapshot-storage component, picks the instance's data-usephp wrapper out of the rebuilt Element tree, and returns it via Renderer::renderPartial() with the refreshed data-usephp-snapshot-update field. Only Isolated routes take this path; Persistent/Session/Shared keep redirecting because the redirect is what writes the snapshot into the URL or the session (/cart is unchanged).
Opt-in client-side persistence — SnapshotPersist (#33)
Snapshot storage keeps the only copy of a component's state in the page (like React's useState), so a reload starts over. Components can now opt in to mirroring that snapshot into Web Storage while the server stays stateless:
use Polidog\UsePhp\Storage\SnapshotPersist;
$Counter = fc($render, 'counter', StorageType::Snapshot, persist: SnapshotPersist::SessionStorage);
#[Component(storage: 'snapshot', persist: 'sessionStorage')] // or 'localStorage'
class Counter extends BaseComponent { ... }- The wrapper gains
data-usephp-persist="sessionStorage|localStorage". usephp.jssaves the snapshot after every partial update (keyed by pathname + instance id) and, on the next page load, POSTs it back as arestoreaction (Action::restore(); no mutation — the posted snapshot is the state). The component is swapped for the server's re-render, which HMAC-verifies the snapshot exactly like any other action. A rejected (400) or redirected restore drops the saved entry.persistis rejected with non-Snapshot storage. Newwindow.usePHP.restoreSnapshots()/forgetSnapshots().- Meant for
Isolatedroutes;persistentSnapshot()/sessionSnapshot()routes already carry the snapshot elsewhere.
Docs & tests
README.md/README.ja.md:persist:option and the reload semantics of Snapshot storage (#33, #34).- New tests:
FunctionComponentActionTest(partial update, multi-instance targeting, persist attribute/validation,restoreround-trip without mutation, tampered restore rejected) andComponentPersistTest(attribute, registry, render paths). PHPStan and php-cs-fixer pass.
Full Changelog: v0.7.3...v0.8.0
v0.7.3 — PSX parameter metadata
What's Changed
- Emit rich PSX component manifest entries with compiled file paths and callable parameter metadata.
- Keep runtime loading compatible with legacy string-only manifests.
- Expose PSX parameter metadata for consumers such as relayer DI/autowiring.
- Improve parameter metadata handling for nullable union service types and PHP-style qualified name resolution.
- Return a normal compile error when parameter metadata cannot be collected.
Validation
- phpstan
- phpunit
v0.7.2 — Fix JSX text with odd apostrophes truncating compiled output
Bug fix
JSX テキスト中の奇数個のアポストロフィでコンパイルが失敗する問題を修正 (#27, #28)
.psx の JSX テキストに ' が奇数個含まれる("it's" / "doesn't" / "you're" のような英文)と、PsxPreProcessor がソース全体をパースできなくなり、コンパイルが PSX namespace context: source could not be parsed at all: Syntax error, unexpected EOF で失敗していました。クロージャ/関数/if の {} ブロックの中から JSX を返すページ(実運用のほぼ全ページ)が踏みうるため、致命度の高いリグレッションでした。
原因: PsxPreProcessor は JSX を含んだソースに token_get_all() を呼び、トークンテキスト長の合計でバイトオフセットを逆算してプレースホルダ置換していました。JSX 内の ' が奇数個だと PHP トークナイザがそこから先を「未終端の単一引用符文字列トークン」として EOF まで飲み込み、オフセット計算が破綻 → プレースホルダ以降の ); や } が出力から脱落し、nikic が unexpected EOF を投げていました。
修正: 反復処理に置き換え、各パスで「最初の」PSX リージョンだけを見つけて substr でプレースホルダにスプライス → 再トークナイズ、を繰り返すようにしました。トークナイザが壊れるのは「JSX より後ろ」のトークンだけで、最初のリージョン開始までの prefix は常に正確なので、信頼できるオフセット 1 個ずつ拾えば十分です。各置換で「壊す入力」が 1 つ消えるため、N 個のリージョンは N 回の反復で完了します。
副次効果として、JSX テキスト中の " / # / // も同様の経路で壊していた潜在的なケースも同時に解消されます。
API 互換性に影響はありません(パッチリリース)。
Full Changelog: v0.7.1...v0.7.2
v0.7.1
Bug fix
SessionStorage がコンストラクタで session_start() していた問題を修正 (#25, #26)
SessionStorage::__construct() が session_start() を呼んでいたため、StorageType::Session の ComponentState を生成しただけ(まだ state を読み書きしていない時点)で PHP セッションが開始され、Cookie 未保持の訪問者に必ず Set-Cookie: PHPSESSID が送出されていました。ComponentState::getInstance() はデフォルトが StorageType::Session で全ページ描画ごとに呼ばれるため、useState を一切使わない静的なページまでキャッシュ不能化していました。
修正: ensureSessionStarted() をコンストラクタから各アクセサ(get / set / has / delete)の先頭へ移動。
new SessionStorage()が副作用ゼロになり、useStateを使わないページではセッションが開始されずSet-Cookieも出ない(HTTP キャッシュ可能に戻る)。useStateを使うページは初回 state アクセスでセッション開始。永続挙動は不変。get/hasでもensureSessionStarted()を実行するため、再訪ユーザーの永続 state がサイレントに失われることはない(コンストラクタ開始が守っていた不変条件を各入口で保全)。
API 互換性に影響はありません(パッチリリース)。
Full Changelog: v0.7.0...v0.7.1
v0.7.0 — Optional localStorage TTL for deferred components
Highlights
An optional time bound for the opt-in localStorage (L2) defer cache, via a new Defer::$localCacheTtl (seconds). The cache stays a deliberate per-component opt-in (the localCache boolean from v0.5.0 is unchanged); the TTL is an orthogonal, no-op-by-default refinement, so existing deferred components are byte-identical to before.
Opting in
#[Defer(name: 'feed', localCache: true, localCacheTtl: 60)]
// or
fc($render, defer: new Defer(name: 'feed', localCache: true, localCacheTtl: 60));Renders a separate data-usephp-defer-cache-ttl="60" attribute next to the bare data-usephp-defer-cache opt-in (mirroring how reloadable added its own attribute, rather than overloading the bare one). localCacheTtl: 0 (the default) emits no attribute — byte-identical markup and behaviour to a plain localCache: true.
Semantics — hard discard, not stale-while-revalidate
Once the persisted entry is older than localCacheTtl seconds, the next read discards it and re-fetches from the network: the fallback shows briefly, then the fresh fragment. There is no stale paint and no background swap. The bound applies to the L2 localStorage tier only — L1 in-memory is per-page anyway. The TTL lives on the placeholder, not in the stored record, so re-tuning it needs no DEFER_CACHE_VERSION bump, and a missing/garbled storedAt is treated as infinitely old (fail-safe re-fetch).
Lenient input
Any localCacheTtl <= 0 means "no time bound": a negative is normalised to 0 and read as such rather than throwing. Only a genuinely positive TTL without localCache: true is rejected (it would bound an entry that's never written) — the real misconfiguration.
Why not the old localCacheTtl?
v0.5.0's predecessor coupled a mandatory TTL to the opt-in and was dropped per feedback in favour of a boolean. This reintroduces the time bound decoupled: boolean opt-in stays, TTL is optional and defaults to a true no-op.
Docs & tests
- New "Optional time bound" / "時間で失効させる" subsection in
README.md/README.ja.md. - Added tests:
Deferdefault/propagation/normalisation and positive-without-localCacherejection; renderer markup contract (emit/omit/compose order, raw non-positive path);fc()propagation. Full suite (370 tests),php-cs-fixer(0/70), PHPStan pass; JS syntax checked.
Full PR: #22 (Copilot review addressed: <= 0 treated as 0 per maintainer call — deliberately lenient instead of throwing; plus $localCache doc, header-comment grammar, and enforcePersistedCap comment accuracy).
Full Changelog: v0.6.0...v0.7.0
v0.6.0 — Opt-in explicit reload for deferred components
Highlights
A new opt-in explicit reload for deferred components. By default a deferred fragment is fetched once and the placeholder is replaced away, leaving nothing to re-target. Defer::$reloadable keeps a re-fetchable wrapper in the DOM so a region can be reloaded later — the canonical "a form mutates data, reload the deferred list" pattern, plus reload from anywhere.
Opting in
#[Defer(name: 'todo-list', reloadable: true)]
// or
fc($render, defer: new Defer(name: 'todo-list', reloadable: true));Renders the placeholder with data-usephp-defer-name. usephp.js then swaps content inside that wrapper instead of replacing it away. Components that don't opt in are byte-identical to before (replaced on resolve). Independent of localCache / cacheControl.
Three triggers, one core API (usephp.js)
// 1. Imperative — from anywhere, no form required:
window.usePHP.reloadDefer(); // every reloadable region
window.usePHP.reloadDefer('todo-list'); // by defer name
window.usePHP.reloadDefer('/_defer/todo-list?p=2'); // by exact URL
// returns the number of regions reloaded (0 ⇒ nothing matched)<!-- 2. After a successful partial form submit (sees the mutated state) -->
<form data-usephp-form data-usephp-reload-defer="todo-list"> … </form>
<!-- 3. On click of any element outside a usephp form -->
<button data-usephp-reload-defer="todo-list">Refresh</button>
Attribute value is a space/comma-separated list of defer names (or exact URLs); empty reloads every reloadable region. Every reload busts both cache tiers for that URL first, so it always reflects current server state. Reload is decoupled from clearDeferCache() (invalidate-only).
Robustness
Per-wrapper single-flight + generation + AbortController: an unforced scan (processDeferred) yields to an in-flight fetch while a forced reloadDefer() supersedes it; a superseded response is discarded before placement and its request aborted, so a wrapper always settles on the newest requested state — no double placement, no stale-then-fresh flicker. The post-submit dispatch runs before the generic scan so the cache-busted fetch wins cleanly.
Docs & tests
- New "Explicit reload" / "明示的リロード" section in
README.md/README.ja.md. - Added tests: renderer markup contract (name attribute on/off, composes with
localCache),Defer/fc()propagation. Full suite (360 tests),php-cs-fixer, PHPStan (changed files) pass; JS syntax checked.
Full PR: #21 (Copilot review addressed: non-Element click-target guard; single-flight/supersede to remove the post-submit double-fetch and flicker).
Full Changelog: v0.5.0...v0.6.0
v0.5.0 — Opt-in localStorage client cache for deferred components
Highlights
A new opt-in client-side cache for deferred components, decided on the component (not inferred from HTTP headers), with a JS forced-reset API.
Two-tier defer cache (usephp.js)
- L1 — in-memory
Map<URL, DocumentFragment>, per page lifetime. Unchanged behaviour. - L2 —
localStorage, surviving reloads and shared across tabs. Strictly opt-in: persisted only when a component setsDefer::$localCache = true(rendered as a baredata-usephp-defer-cacheattribute). No HTTPCache-Controlis inspected; no time expiry. Components that don't opt in behave exactly like the previous in-memory-only cache, so session-coupled defaults can't leak content on a shared terminal.
Read order is L1 → L2 → network; an L2 hit is promoted into L1. Both tiers are URL-keyed and capped at 64 entries. If localStorage is unavailable, L2 silently no-ops.
Opting in
#[Defer(name: 'announcement-bar', localCache: true)]
// or
fc($render, defer: new Defer(name: 'announcement-bar', localCache: true));localCache and cacheControl are independent (cacheControl governs server/CDN caching only).
Forced reset (JS)
window.usePHP.clearDeferCache(); // both tiers, everything
window.usePHP.clearDeferCache('post-comments'); // every variant of one defer name
window.usePHP.clearDeferCache('/_defer/post-comments?post_id=1'); // one exact placeholder URL
window.usePHP.DEFER_CACHE_VERSION; // current build's valueSince there's no expiry, invalidate via DEFER_CACHE_VERSION (bump on deploy) or clearDeferCache() (runtime). Each persisted record is stamped with DEFER_CACHE_VERSION and version mismatches are rejected/pruned on read and during cap eviction, so a write from an older still-open tab after a deploy can't be served by a newer build.
Docs & tests
- New "Client-side cache & forced reset" / "クライアントキャッシュと強制リセット" section in
README.md/README.ja.md. - Added tests: renderer attribute on/off,
Defer::$localCachedefault/propagation,fc()propagation. Full suite,php-cs-fixer, and PHPStan pass.
Full PR: #20 (review feedback addressed: per-record version race fixed; obsolete Cache-Control parsing removed).
Full Changelog: v0.4.0...v0.5.0
v0.4.0 - Component-side defer declaration
Defer metadata moves from the PSX call site onto the component itself, and usephp compile auto-discovers every endpoint. This is a breaking change to the defer API — the magic defer / fallback PSX attributes are gone and replaced with explicit wrapper components.
Breaking: defer config lives on the component (#17)
Before (v0.3.0):
<UserHeader defer="user-header" fallback={<HeaderSkeleton />} />
$app->registerDeferred(
name: 'user-header',
component: 'App\\Components\\Psx\\UserHeader',
cacheControl: 'private, no-store',
);After (v0.4.0): split into a base component and a deferred wrapper that carries the Defer config.
{/* UserHeaderDeferred.psx — the wrapper */}
use Polidog\UsePhp\Component\Defer;
use function Polidog\UsePhp\Runtime\fc;
return fc(
fn(array $props) => <UserHeader />,
defer: new Defer(name: 'user-header', cacheControl: 'private, no-store'),
);
{/* Page.psx — fallback is a normal prop */}
<UserHeaderDeferred fallback={<HeaderSkeleton />} />
// No registerDeferred() call — loadComponentManifest() picks up the
// deferred-manifest.php sidecar that `usephp compile` writes.
$app->loadComponentManifest($manifestPath);Class components use the same idea via #[Defer(...)]:
#[Component(name: 'UserHeaderDeferred')]
#[Defer(name: 'user-header', cacheControl: 'private, no-store')]
final class UserHeaderDeferred extends BaseComponent
{
public function render(): Element { /* the endpoint-side content */ }
}
$app->register(UserHeaderDeferred::class); // endpoint + PSX placeholder both wiredWhy
- Single source of truth for each defer endpoint — name and cache policy travel with the component, no parallel
registerDeferred()list to keep in sync. usephp compileenumerates every endpoint at build time, so the framework can auto-register them; manual wiring goes away.- Removes the PSX parser's special-casing of
deferandfallback— every prop is now a normal prop.
Migration
- For each component that was used with
defer="…"in PSX, create a wrapper component:- Closure form: new
.psxreturningfc(fn(\$props) => <Base />, defer: new Defer(name: '…', cacheControl: '…')). - Class form: new
BaseComponentsubclass annotated with#[Defer(name: '…', cacheControl: '…')].
- Closure form: new
- Replace
<Base defer="…" fallback={…} />with<BaseDeferred fallback={…} />at every call site. - Drop the corresponding
\$app->registerDeferred(...)calls. - Re-run
usephp compileso the newdeferred-manifest.phpsidecar is generated.
Other changes
fc()now returns an invokableFunctionComponent(still callable, exposesdeferfor inspection).loadComponentManifest()also picks updeferred-manifest.phpnext tomanifest.php.Defer::buildPlaceholder()is the shared materialiser used by both the closure wrapper and the class-component PSX bridge.
Full Changelog: v0.3.0...v0.4.0