PHP Class Puli\Repository\StreamWrapper\ResourceStreamWrapper

To register the stream wrapper, call {@link register}: php use Puli\Repository\InMemoryRepository; use Puli\Repository\StreamWrapper\ResourceStreamWrapper; $repo = new InMemoryRepository(); ResourceStreamWrapper::register('puli', $repo); file_get_contents('puli:///css/style.css'); => $puliRepo->get('/css/style.css')->getBody() The stream wrapper can only be used for reading, not writing.
Since: 1.0
Author: Bernhard Schussek ([email protected])
Inheritance: implements Puli\Repository\StreamWrapper\StreamWrapper
Datei anzeigen Open project: puli/repository Class Usage Examples

Public Methods

Method Description
dir_closedir ( )
dir_opendir ( $uri, $options )
dir_readdir ( )
dir_rewinddir ( )
mkdir ( $uri, $mode, $options )
register ( string $scheme, Puli\Repository\Api\ResourceRepository | callable $repositoryFactory ) Registers a repository as PHP stream wrapper.
rename ( $uriFrom, $uriTo )
rmdir ( $uri, $options )
stream_cast ( $castAs )
stream_close ( )
stream_eof ( )
stream_flush ( )
stream_lock ( $operation )
stream_metadata ( $uri, $option )
stream_open ( $uri, $mode, $options, &$openedPath )
stream_read ( $length )
stream_seek ( $offset, $whence = SEEK_SET )
stream_set_option ( $option, $arg1, $arg2 )
stream_stat ( )
stream_tell ( )
stream_truncate ( $newSize )
stream_write ( $data )
unlink ( $uri )
unregister ( string $scheme ) Unregisters the given scheme.
url_stat ( $uri, $flags )

Private Methods

Method Description
getRepository ( string $scheme ) : Puli\Repository\Api\ResourceRepository Constructs (if necessary) and returns the repository for the given scheme.

Method Details

dir_closedir() public method

public dir_closedir ( )

dir_opendir() public method

public dir_opendir ( $uri, $options )

dir_readdir() public method

public dir_readdir ( )

dir_rewinddir() public method

public dir_rewinddir ( )

mkdir() public method

public mkdir ( $uri, $mode, $options )

register() public static method

The resources of the repository can subsequently be accessed with PHP's file system by prefixing the resource paths with the registered URI scheme: php ResourceStreamWrapper::register('puli', $repo); /app/css/style.css $contents = file_get_contents('puli:///app/css/style.css'); Instead of passing a repository, you can also pass a callable. The callable is executed when the repository is accessed for the first time and should return a valid {@link ResourceRepository} instance.
public static register ( string $scheme, Puli\Repository\Api\ResourceRepository | callable $repositoryFactory )
$scheme string The URI scheme.
$repositoryFactory Puli\Repository\Api\ResourceRepository | callable The repository to use.

rename() public method

public rename ( $uriFrom, $uriTo )

rmdir() public method

public rmdir ( $uri, $options )

stream_cast() public method

public stream_cast ( $castAs )

stream_close() public method

public stream_close ( )

stream_eof() public method

public stream_eof ( )

stream_flush() public method

public stream_flush ( )

stream_lock() public method

public stream_lock ( $operation )

stream_metadata() public method

public stream_metadata ( $uri, $option )

stream_open() public method

public stream_open ( $uri, $mode, $options, &$openedPath )

stream_read() public method

public stream_read ( $length )

stream_seek() public method

public stream_seek ( $offset, $whence = SEEK_SET )

stream_set_option() public method

public stream_set_option ( $option, $arg1, $arg2 )

stream_stat() public method

public stream_stat ( )

stream_tell() public method

public stream_tell ( )

stream_truncate() public method

public stream_truncate ( $newSize )

stream_write() public method

public stream_write ( $data )

unregister() public static method

Unknown schemes are ignored.
public static unregister ( string $scheme )
$scheme string A URI scheme.

url_stat() public method

public url_stat ( $uri, $flags )