I would advise against using
realpath in this case because this function must consult the file system in order to return the pathname, which adds some overhead.
__DIR__ alone is sufficient because it returns absolute pathname itself so the
realpath() function is redundant.
One thing to note is that you can use relative paths following an absolute path so if you assign your ROOT constant somewhere deeper in the directory tree you can define a directory one level up (or more) in this way:
define('ROOT', __DIR__ . '/..');
require_once(ROOT . '/config.php');
which can be equivalent to
which is the same as
and will work just fine.