Skip to content

Instantly share code, notes, and snippets.

@felixhummel
Created December 1, 2011 14:10
Show Gist options
  • Save felixhummel/1416996 to your computer and use it in GitHub Desktop.
Save felixhummel/1416996 to your computer and use it in GitHub Desktop.
PHP Symfony get absolute path from relative Path
$relativePath = $this->config['foo'];
$pseudoPath = sfConfig::get('sf_root_dir') . DIRECTORY_SEPARATOR . $relativePath;
$absolutePath = realpath($pseudoPath);
if (!$absolutePath) {
throw new Exception("File not found: $pseudoPath");
}
$this->use($absolutePath);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment