Download the PHP package polidog/rosanna-defer without Composer
On this page you can find all versions of the php package polidog/rosanna-defer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download polidog/rosanna-defer
More information about polidog/rosanna-defer
Files in polidog/rosanna-defer
Package rosanna-defer
Short Description Deferred fragments for Rosanna: placeholders, a GET endpoint, client caching and rosanna-defer.js, without sessions or state
License MIT
Informations about the package rosanna-defer
Rosanna Defer
日本語
polidog/rosanna-defer fetches parts of a Rosanna page in a separate request after load, so the page itself can sit on a CDN while per-visitor or slow parts stay separate.
It uses no session and no state. If you need useState or buttons that go through the server, use polidog/rosanna-state, which includes this package.
Install
Usage
A host with its own Renderer uses new Renderer(deferred: $app->placeholderRenderer()). A host with its own request object passes new DeferRequest($method, $path, $query, $queryString).
Caching
| Option | Meaning |
|---|---|
cacheControl |
The endpoint's Cache-Control. Defaults to private, max-age=0 |
localCache |
Store in the browser's localStorage |
localCacheTtl |
Seconds to keep it in localStorage |
reloadable |
Keep the wrapper after loading so Rosanna.reloadDefer(name) can fetch again |
- A fragment with a form or a
type=hiddeninput is never written tolocalStorage, even withlocalCache, so CSRF tokens do not stay on a shared device. - A response that uses the session or sets a cookie is sent as
private, no-store, even ifcacheControlallows shared caches. /_defer/{name}is a public GET outside the host's protection, and its query is untrusted input. Authorize inside the target.
Artifacts from vendor/bin/rosanna compile are refused because it does not look for defer. Use vendor/bin/rosanna-defer compile.
Specification
docs/spec/01-defer.md