Having done more work on
vfsStream I felt it is time to do the next release before starting to work on the next big issue™. The new 0.2.0 release focuses on API improvements as well as support for differentiating between directories and files. API improvements are a new vfsStream::url() method to assist in creating correct vfsStream urls. Up until now you had to write something like
$url = vfsStreamWrapper::PROTOCOL . '://path/to/file.txt';
which is kind of ugly and unhandy to type. Now you can do
$url = vfsStream::url('path/to/file.txt'); which should be easier and less to type.
Another API improvement is the new vfsStream::newFile() method to be able to do
$file = vfsStream::newFile("foo.txt")->withContent("bar");
Following an advice by David Zülke I changed vfsStreamWrapper::register() to reset the directory root to null.
Additionally vfsStream now supports is_dir(), is_file() and is_readable(). However there is still a small drawback to is_readable(), as long as file mode is not supported existing pathes will lead to true, and non-existing pathes to false. Currently all files and directories always have 0777 as file mode. As I require support for file modes now this will be part of the 0.3.0 release.
Another thing I found during the last days is that realpath() seems only to work with real files, but not with any other URL types. That's a bit sad because it means one can not use this function if one wants to test its file operations with vfsStream.