Skip to content

Conversation

adlawson
Copy link
Owner

While symlink() isn't supported by PHP Stream Wrappers to create symlinks, you can still interact with symlinks that already exist.

<?php
use Vfs\FileSystemBuilder;
use Vfs\Node\FileLink;

$fs = (new FileSystemBuilder())->setTree(['foo' => ['bar' => 'baz']])->build();
$fs->get('/')->add(new FileLink('my_symlink', $fs->get('/foo/bar')));

is_link('vfs://my_symlink'); // => true

They're actually implemented as hard links rather than symbolic links, meaning that if the target file is moved or renamed the link still works. It was easier to implement this way.

adlawson added a commit that referenced this pull request Jul 24, 2015
@adlawson adlawson merged commit 8809507 into develop Jul 24, 2015
@adlawson adlawson deleted the feature/symlinks branch July 24, 2015 16:23
@adlawson adlawson mentioned this pull request Jul 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant