1. Go to this page and download the library: Download qcodr/restate-sdk-laravel 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/ */
qcodr / restate-sdk-laravel example snippets
namespace App\Restate;
use Qcodr\Restate\Sdk\Context\Context;
use Qcodr\Restate\Sdk\Service\Attribute\{Service, Handler};
#[Service]
final class GreeterService
{
public function __construct(private readonly \App\Services\Mailer $mailer) {}
#[Handler]
public function greet(Context $ctx, string $name): string
{
// Non-deterministic work (DB, HTTP, mail) goes inside ctx->run() so it runs
// exactly once and replays from the journal on retries.
$ctx->run('notify', fn () => $this->mailer->ping($name));
return "Hello {$name}";
}
}