1. Go to this page and download the library: Download polidog/rosanna-defer library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
polidog / rosanna-defer example snippets
// components/UserHeader.psx
namespace App;
use Polidog\Rosanna\Defer\Defer;
use function Polidog\Rosanna\Defer\deferred;
return deferred(
fn (array $props, UserRepository $users) => <p>{$users->current()->name}</p>,
new Defer(name: 'user-header', cacheControl: 'private, no-store'),
);
use Polidog\Rosanna\Defer\RosannaDefer;
$app = new RosannaDefer();
$app->loadComponentManifest(__DIR__ . '/var/cache/psx/manifest.php');
// Supplies arguments after $props, such as `$users`. Implements Polidog\Rosanna\Runtime\PsxArgumentResolver; without it the render returns 500
$app->setArgumentResolver($yourResolver);
// Call before page handling. Returns null unless the path is /_defer/{name}
$response = $app->handleDeferred();
if ($response !== null) {
$response->send();
return;
}
// On the page, <UserHeader /> renders as a placeholder
echo RosannaDefer::renderClientScript();
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.