Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Return a formatted string
sprintf(string $format, mixed ...$values): string
{
$updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
$updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
{
$updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
$updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
{
$updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
$updatedStaticLoader = str_replace(
"__DIR__ . '/../..'",
sprintf("'%s'", rtrim(getenv('LAMBDA_TASK_ROOT'), '/')),
file_get_contents(self::AUTOLOAD_STATIC_PATH)
);
foreach (LAYER_NAMES as $layerName) {
$results[$layerName] = $lambda->listLayerVersions([
'LayerName' => sprintf('arn:aws:lambda:%s:209497400698:layer:%s', $selectedRegion, $layerName),
'MaxItems' => 1,
]);
}
$results[$layerName] = $lambda->listLayerVersions([
'LayerName' => sprintf('arn:aws:lambda:%s:209497400698:layer:%s', $selectedRegion, $layerName),
'MaxItems' => 1,
]);
}
{
$jsonData = json_encode($data);
if ($jsonData === false) {
throw new Exception(sprintf(
"The Lambda response cannot be encoded to JSON.\nThis error usually happens when you try to return binary content. If you are writing an HTTP application and you want to return a binary HTTP response (like an image, a PDF, etc.), please read this guide: https://bref.sh/docs/runtimes/http.html#binary-requests-and-responses\nHere is the original JSON error: '%s'",
json_last_error_msg()
));
}
if ($this->curlHandleResult === null) {
$jsonData = json_encode($data);
if ($jsonData === false) {
throw new Exception(sprintf(
"The Lambda response cannot be encoded to JSON.\nThis error usually happens when you try to return binary content. If you are writing an HTTP application and you want to return a binary HTTP response (like an image, a PDF, etc.), please read this guide: https://bref.sh/docs/runtimes/http.html#binary-requests-and-responses\nHere is the original JSON error: '%s'",
json_last_error_msg()
));
}
if ($this->curlHandleResult === null) {
$this->client = new WebsocketClient(
[
'region' => $region,
'endpoint' => sprintf('https://%s.execute-api.%s.amazonaws.com', $apiId, $region),
],
$credentialProvider,
$httpClient
[
'region' => $region,
'endpoint' => sprintf('https://%s.execute-api.%s.amazonaws.com', $apiId, $region),
],
$credentialProvider,
$httpClient
public function disconnect(string $connectionId): void
{
$this->client->request('DELETE', sprintf('/%s/@connections/%s', $this->stage, $connectionId));
}
public function message(string $connectionId, string $body): void
{
$this->client->request('DELETE', sprintf('/%s/@connections/%s', $this->stage, $connectionId));
}
public function message(string $connectionId, string $body): void
public function message(string $connectionId, string $body): void
{
$this->client->request('POST', sprintf('/%s/@connections/%s', $this->stage, $connectionId), $body);
}
public function status(string $connectionId): WebsocketClientStatus
{
$this->client->request('POST', sprintf('/%s/@connections/%s', $this->stage, $connectionId), $body);
}
public function status(string $connectionId): WebsocketClientStatus
public function status(string $connectionId): WebsocketClientStatus
{
return new WebsocketClientStatus(
$this->client->request('GET', sprintf('/%s/@connections/%s', $this->stage, $connectionId))
->toArray()
);
}
{
return new WebsocketClientStatus(
$this->client->request('GET', sprintf('/%s/@connections/%s', $this->stage, $connectionId))
->toArray()
);
}