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
Afficher le fichier Open project: puli/repository Class Usage Examples

Méthodes publiques

Méthode 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

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

Method Details

dir_closedir() public méthode

public dir_closedir ( )

dir_opendir() public méthode

public dir_opendir ( $uri, $options )

dir_readdir() public méthode

public dir_readdir ( )

dir_rewinddir() public méthode

public dir_rewinddir ( )

mkdir() public méthode

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

register() public static méthode

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 méthode

public rename ( $uriFrom, $uriTo )

rmdir() public méthode

public rmdir ( $uri, $options )

stream_cast() public méthode

public stream_cast ( $castAs )

stream_close() public méthode

public stream_close ( )

stream_eof() public méthode

public stream_eof ( )

stream_flush() public méthode

public stream_flush ( )

stream_lock() public méthode

public stream_lock ( $operation )

stream_metadata() public méthode

public stream_metadata ( $uri, $option )

stream_open() public méthode

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

stream_read() public méthode

public stream_read ( $length )

stream_seek() public méthode

public stream_seek ( $offset, $whence = SEEK_SET )

stream_set_option() public méthode

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

stream_stat() public méthode

public stream_stat ( )

stream_tell() public méthode

public stream_tell ( )

stream_truncate() public méthode

public stream_truncate ( $newSize )

stream_write() public méthode

public stream_write ( $data )

unregister() public static méthode

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

url_stat() public méthode

public url_stat ( $uri, $flags )