Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Opens file or URL
<?php fopen(    string $filename,    string $mode,    bool $use_include_path = false,    ?resource $context = null): resource|false
<?php function stream_with_contents(string $contents)

{

    $stream = fopen('php://temp', 'w+b');

    fwrite($stream, $contents);

    rewind($stream);
<?php     public function write(string $path, string $contents, Config $config): void

    {

        try {

            $writeStream = fopen('php://temp', 'w+b');

            fwrite($writeStream, $contents);

            rewind($writeStream);

            $this->writeStream($path, $writeStream, $config);
<?php     public function readStream(string $path)

    {

        $location = $this->prefixer->prefixPath($path);

        $stream = fopen('php://temp', 'w+b');

        $result = @ftp_fget($this->connection(), $stream, $location, $this->connectionOptions->transferMode());



        if ( ! $result) {
<?php     public function readStream()

    {


        $stream = fopen('php://temp', 'w+b');

        fwrite($stream, $this->contents);

        rewind($stream);
<?php         );



        error_clear_last();

        $stream = @fopen($prefixedLocation, 'w+b');



        if ( ! ($stream && false !== stream_copy_to_stream($contents, $stream) && fclose($stream))) {

            $reason = error_get_last()['message'] ?? '';
<?php     {

        $location = $this->prefixer->prefixPath($path);

        error_clear_last();

        $contents = @fopen($location, 'rb');



        if ($contents === false) {

            throw UnableToReadFile::fromLocation($path, error_get_last()['message'] ?? '');
<?php         $location = $this->prefixer->prefixPath($path);

        $connection = $this->connectionProvider->provideConnection();


        $readStream = fopen('php://temp', 'w+');



        if ( ! $connection->get($location, $readStream)) {

            fclose($readStream);
<?php         $location = $this->prefixer->prefixPath($path);

        $connection = $this->connectionProvider->provideConnection();


        $readStream = fopen('php://temp', 'w+');



        if ( ! $connection->get($location, $readStream)) {

            fclose($readStream);