Supported Versions: PHP 5 >= 5.2.0, PHP 7, PHP 8, PECL json >= 1.2.0
Returns the JSON representation of a value
<?php json_encode(mixed $value, int $flags = 0, int $depth = 512): string|false
<?php             'request' => $this->requestInfo($stream, $verbosity),

            'throwable' => $this->throwableInfo($stream, $verbosity),

            'shutdown' => $this->shutdownInfo($stream, $verbosity),

            default => $this->info(json_encode($stream, $verbosity))

        };

    }

}
<?php         return tap(new Process([

            (new ExecutableFinder)->find('node'),

            'file-watcher.js',

            json_encode(collect(config('octane.watch'))->map(fn ($path) => base_path($path))),

        ], realpath(__DIR__.'/../../../bin'), null, null, null))->start();

    }
<?php {

    public function __construct(public array $vars)

    {

        $this->message = json_encode($vars);

    }
<?php             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), ['masterProcessId' => $masterProcessId]),

            JSON_PRETTY_PRINT

        ));

    }
<?php             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), ['state' => $newState]),

            JSON_PRETTY_PRINT

        ));

    }
<?php     public static function request(string $method, string $url, int $statusCode, float $duration)

    {

        fwrite(STDOUT, json_encode([

            'type' => 'request',

            'method' => $method,

            'url' => $url,

            'memory' => memory_get_usage(),

            'statusCode' => $statusCode,

            'duration' => $duration,

        ])."\n");

    }
<?php             ? collect($throwable->getTrace())->whereNotNull('file')->first()

            : null;



        fwrite(STDERR, json_encode([

            'type' => 'throwable',

            'class' => $throwable::class,

            'code' => $throwable->getCode(),

            'file' => $fallbackTrace['file'] ?? $throwable->getFile(),

            'line' => $fallbackTrace['line'] ?? (int) $throwable->getLine(),

            'message' => $throwable->getMessage(),

            'trace' => array_slice($throwable->getTrace(), 0, 2),

        ])."\n");

    }
<?php     public static function shutdown(Throwable $throwable)

    {

        fwrite(STDERR, json_encode([

            'type' => 'shutdown',

            'class' => $throwable::class,

            'code' => $throwable->getCode(),

            'file' => $throwable->getFile(),

            'line' => $throwable->getLine(),

            'message' => $throwable->getMessage(),

            'trace' => array_slice($throwable->getTrace(), 0, 2),

        ])."\n");

    }

}
<?php             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), [

                'masterProcessId' => $masterProcessId,

                'managerProcessId' => $managerProcessId,

            ]),

            JSON_PRETTY_PRINT

        ));

    }
<?php             throw new RuntimeException('Unable to write to process ID file.');

        }



        file_put_contents($this->path, json_encode(

            array_merge($this->read(), ['state' => $newState]),

            JSON_PRETTY_PRINT

        ));

    }
<?php         $dispatcher = new SequentialTaskDispatcher();



        $this->expectException(DdException::class);

        $this->expectExceptionMessage(json_encode(['foo' => 'bar']));



        $dispatcher->resolve([

            'first' => fn () => throw new DdException(['foo' => 'bar']),
<?php         }));



        $this->expectException(DdException::class);

        $this->expectExceptionMessage(json_encode(['foo' => 'bar']));



        $dispatcher->resolve([

            'first' => fn () => throw new DdException(['foo' => 'bar']),