PHP 클래스 Puli\Repository\OptimizedJsonRepository
The generated JSON file is described by res/schema/repository-schema-1.0.json.
Resources can be added with the method {@link add()}:
php
use Puli\Repository\OptimizedJsonRepository;
$repo = new OptimizedJsonRepository('/path/to/repository.json', '/path/to/project');
$repo->add('/css', new DirectoryResource('/path/to/project/res/css'));
When adding a resource, the added filesystem path is stored in the JSON file
under the key of the Puli path. The path is stored relatively to the base
directory passed to the constructor. Directories will be expanded and all
nested files will be added to the mapping file as well:
json
{
"/css": "res/css",
"/css/style.css": "res/css/style.css"
}
Mapped resources can be read with the method {@link get()}:
php
$cssPath = $repo->get('/css')->getFilesystemPath();
You can also access nested files:
php
echo $repo->get('/css/style.css')->getBody();
Since nested files are searched during {@link add()} and added to the JSON
file, this repository does not detect any files that you add to a directory
after adding that directory to the repository. This means that accessing
files is very fast, but also that the usage of this repository implementation
can be cumbersome in development environments. There you are recommended to
use {@link JsonRepository} instead.
파일 보기
프로젝트 열기: puli/repository
공개 메소드들
보호된 메소드들
메소드 상세
addFilesystemResource()
보호된 메소드
protected addFilesystemResource ( $path, Puli\Repository\Api\Resource\FilesystemResource $resource ) |
$resource |
Puli\Repository\Api\Resource\FilesystemResource |
|
getReferencesForGlob()
보호된 메소드
getReferencesForPath()
보호된 메소드
getReferencesForRegex()
보호된 메소드
getReferencesInDirectory()
보호된 메소드
insertReference()
보호된 메소드
removeReferences()
보호된 메소드