PHP code example of medz / stream-wrapper-interface

1. Go to this page and download the library: Download medz/stream-wrapper-interface 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/ */

    

medz / stream-wrapper-interface example snippets


use Medz\Component\WrapperInterface\WrapperInterface

class DemoStream implements WrapperInterface
{
    /**
     * Enter description here...
     *
     * @param string $path
     * @param string $mode
     * @param int    $options
     * @param string &$opened_path
     *
     * @return bool
     */
    public function stream_open($path, $mode, $options, &$opened_path)
    {
        // TODO
    }
}


stream_register_wrapper('demo', 'DemoStream');

// get
file_get_contents('demo://test.txt');

// put
file_put_contents('demo://test.txt', 'This is a test content.');

use Symfony\Component\Finder\Finder;

$finder = new Finder();
$finder->files()->in('demo://src');

foreach ($finder as $file)
{
    var_dump($file);
}