Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0
Decodes a JSON string
<?php json_decode( string $json, ?bool $associative = null, int $depth = 512, int $flags = 0): mixed
<?php $tmp = __DIR__ . '/_runtime_components.json';
if (file_exists($tmp)) {
$components = json_decode(file_get_contents($tmp));
foreach ($components as $name => $class) {
if (is_numeric($name)) {
<?php {
$data = (string) str($html)->betweenFirst($attribute.'="', '"');
return json_decode(
htmlspecialchars_decode($data, ENT_QUOTES|ENT_SUBSTITUTE),
associative: true,
);
}
}
<?php $this->info('Monitoring for checksum errors...');
while (true) {
$cache = json_decode(File::get($file), true);
if ($cache['failure']) {
$this->info('Failure: '.$cache['failure']);
<?php })->purpose('Debug checksum errors in Livewire');
on('checksum.fail', function ($checksum, $comparitor, $tamperedSnapshot) use ($file) {
$cache = json_decode(File::get($file), true);
if (! isset($cache['checksums'][$checksum])) return;
<?php });
on('checksum.generate', function ($checksum, $snapshot) use ($file) {
$cache = json_decode(File::get($file), true);
$cache['checksums'][$checksum] = $snapshot;
<?php }
if (str($subject)->startsWith('livewire-files:')) {
$paths = json_decode(str($subject)->after('livewire-files:'), true);
return collect($paths)->map(function ($path) { return static::createFromLivewire($path); })->toArray();
}
<?php ? str_ireplace('files', $name, $errorsInJson)
: str_ireplace('files.0', $name, $errorsInJson);
$errors = json_decode($errorsInJson, true)['errors'];
throw (ValidationException::withMessages($errors));
}
<?php function resurrectMountParams($encoded)
{
$snapshot = json_decode(base64_decode($encoded), associative: true);
$this->registerContainerComponent();
<?php if ($initialValue === 'noexist') return;
$decoded = is_array($initialValue)
? json_decode(json_encode($initialValue), true)
: json_decode($initialValue, true);
<?php $decoded = is_array($initialValue)
? json_decode(json_encode($initialValue), true)
: json_decode($initialValue, true);
<?php if (file_exists($tmp)) {
[$id, $testClass, $method] = json_decode(file_get_contents($tmp), associative: true);
if (! method_exists($testClass, $method)) return;
<?php $componentResponsePayload = $json['components'][0];
$snapshot = json_decode($componentResponsePayload['snapshot'], true);
$effects = $componentResponsePayload['effects'];
<?php function originalPath()
{
if ($this->isLivewireRequest()) {
$snapshot = json_decode(request('components.0.snapshot'), true);
return data_get($snapshot, 'memo.path', 'POST');
}
<?php function originalMethod()
{
if ($this->isLivewireRequest()) {
$snapshot = json_decode(request('components.0.snapshot'), true);
return data_get($snapshot, 'memo.method', 'POST');
}
<?php $url = (string) str($url)->when(! str($url)->isUrl(), fn($url) => $url->start('/'));
$manifest = json_decode(file_get_contents(__DIR__.'/../../../dist/manifest.json'), true);
$versionHash = $manifest['/livewire.js'];
$url = "{$url}?id={$versionHash}";