{"action":"created","issue":{"url":"https://api.github.com/repos/mikey179/vfsStream/issues/127","labels_url":"https://api.github.com/repos/mikey179/vfsStream/issues/127/labels{/name}","comments_url":"https://api.github.com/repos/mikey179/vfsStream/issues/127/comments","events_url":"https://api.github.com/repos/mikey179/vfsStream/issues/127/events","html_url":"https://github.com/mikey179/vfsStream/issues/127","id":124542257,"number":127,"title":"Insert a file into specific directory","user":{"login":"sitilge","id":3306642,"avatar_url":"https://avatars.githubusercontent.com/u/3306642?v=3","gravatar_id":"","url":"https://api.github.com/users/sitilge","html_url":"https://github.com/sitilge","followers_url":"https://api.github.com/users/sitilge/followers","following_url":"https://api.github.com/users/sitilge/following{/other_user}","gists_url":"https://api.github.com/users/sitilge/gists{/gist_id}","starred_url":"https://api.github.com/users/sitilge/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sitilge/subscriptions","organizations_url":"https://api.github.com/users/sitilge/orgs","repos_url":"https://api.github.com/users/sitilge/repos","events_url":"https://api.github.com/users/sitilge/events{/privacy}","received_events_url":"https://api.github.com/users/sitilge/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-01T11:47:23Z","updated_at":"2016-01-06T12:02:32Z","closed_at":null,"body":"Is it possible to insert a ```file``` into specific directory, for example, under ```dir``` directory? \r\n\r\n```\r\n$directories = explode('/', 'path/to/some/dir');\r\n\r\n$structure = [];\r\n$reference =& $structure;\r\n\r\nforeach ($directories as $directory) {\r\n    $reference[$directory] = [];\r\n    $reference =& $reference[$directory];\r\n}\r\n\r\nvfsStream::setup();\r\n$root = vfsStream::create($structure);\r\n$file = vfsStream::newFile('file')\r\n    ->at($root) //should changes be introduced here?\r\n    ->setContent($content = 'Some content here');\r\n```"},"comment":{"url":"https://api.github.com/repos/mikey179/vfsStream/issues/comments/169308533","html_url":"https://github.com/mikey179/vfsStream/issues/127#issuecomment-169308533","issue_url":"https://api.github.com/repos/mikey179/vfsStream/issues/127","id":169308533,"user":{"login":"mikey179","id":190475,"avatar_url":"https://avatars.githubusercontent.com/u/190475?v=3","gravatar_id":"","url":"https://api.github.com/users/mikey179","html_url":"https://github.com/mikey179","followers_url":"https://api.github.com/users/mikey179/followers","following_url":"https://api.github.com/users/mikey179/following{/other_user}","gists_url":"https://api.github.com/users/mikey179/gists{/gist_id}","starred_url":"https://api.github.com/users/mikey179/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mikey179/subscriptions","organizations_url":"https://api.github.com/users/mikey179/orgs","repos_url":"https://api.github.com/users/mikey179/repos","events_url":"https://api.github.com/users/mikey179/events{/privacy}","received_events_url":"https://api.github.com/users/mikey179/received_events","type":"User","site_admin":false},"created_at":"2016-01-06T12:02:32Z","updated_at":"2016-01-06T12:02:32Z","body":"Sure, instead of `->at($root)` you can specify another directory, e.g. something like `->at($root->getChild('path/to/some/dir'))`."}}