src/Path.php
public static function getHomeDirectory()
    {
        // For UNIX support
        if (getenv('HOME')) {
            return static::canonicalize(getenv('HOME'));
        }

        // For >= Windows8 support
        if (getenv('HOMEDRIVE') && getenv('HOMEPATH')) {
            return static::canonicalize(getenv('HOMEDRIVE').getenv('HOMEPATH'));
        }

        throw new RuntimeException("Your environment or operation system isn't supported");
    }
public static function getHomeDirectory()
    {
        // For UNIX support
        if (getenv('HOME')) {
            return static::canonicalize(getenv('HOME'));
        }

        // For >= Windows8 support
        if (getenv('HOMEDRIVE') && getenv('HOMEPATH')) {
            return static::canonicalize(getenv('HOMEDRIVE').getenv('HOMEPATH'));
        }

        throw new RuntimeException("Your environment or operation system isn't supported");
    }
public static function getHomeDirectory ( ) { // For UNIX support if ( getenv ( 'HOME' ) ) { return static :: canonicalize ( getenv ( 'HOME' ) ) ; } // For >= Windows8 support if ( getenv ( 'HOMEDRIVE' ) && getenv ( 'HOMEPATH' ) ) { return static :: canonicalize ( getenv ( 'HOMEDRIVE' ) . getenv ( 'HOMEPATH' ) ) ; } throw new RuntimeException ( "Your environment or operation system isn't supported" ) ; }
Returns canonical path of the user's home directory.

Supported operating systems:

- UNIX
- Windows8 and upper

If your operation system or environment isn't supported, an exception is thrown.

The result is a canonical path.

@return string The canonical home directory

@throws RuntimeException If your operation system or environment isn't supported

@since 2.1 Added method.
Returns canonical path of the user s home directory .