PHP Class Puli\Repository\FilesystemRepository
Resources can be read using their absolute file system paths:
php
use Puli\Repository\FilesystemRepository;
$repo = new FilesystemRepository();
$resource = $repo->get('/home/puli/.gitconfig');
The returned resources implement {@link FilesystemResource}.
Optionally, a root directory can be passed to the constructor. Then all paths
will be read relative to that directory:
php
$repo = new FilesystemRepository('/home/puli');
$resource = $repo->get('/.gitconfig');
While "." and ".." segments are supported, files outside the root directory
cannot be read. Any leading ".." segments will simply be stripped off.
显示文件
Open project: puli/repository
Class Usage Examples
Public Methods
Private Methods
Method Details
__construct()
public method
Creates a new repository.
public __construct ( string $baseDir = '/', boolean $symlink = true, boolean $relative = true, Puli\Repository\Api\ChangeStream\ChangeStream $changeStream = null ) |
$baseDir |
string |
The base directory of the repository on the file
system. |
$symlink |
boolean |
Whether to use symbolic links for added files. If
symbolic links are not supported on the current
system, the repository will create hard copies
instead. |
$relative |
boolean |
Whether to create relative symbolic links. If
relative links are not supported on the current
system, the repository will create absolute links
instead. |
$changeStream |
Puli\Repository\Api\ChangeStream\ChangeStream |
If provided, the repository will log
resources changes in this change stream. |
public add ( $path, $resource ) |
public contains ( $query, $language = 'glob' ) |
public find ( $query, $language = 'glob' ) |
hasChildren()
public method
isSymlinkSupported()
public static method
Returns whether symlinks are supported in the local environment.
listChildren()
public method
public remove ( $query, $language = 'glob' ) |