Roave\Realpath is an alternative implementation for PHP's built-in realpath()
function, that provides better feedback by way of throwing exceptions instead
of just silently returning false.
Simply require using composer:
$ composer require roave/realpath
use Roave\Realpath\Realpath;
$myRealPath = Realpath::get($potentialPath);