src/Env.php
public static function getArrayFromPrefix($prefix)
    {
        self::assertEnvListAvailable();
        
        if (empty($prefix)) {
            throw new Exception(
                'You must provide a non-empty prefix to search for.',
                1496164608
            );
        }
        
        $results = [];
        
        foreach (array_keys($_ENV) as $name) {
            if (self::startsWith($name, $prefix)) {
                $nameAfterPrefix = substr($name, strlen($prefix));
                $results[$nameAfterPrefix] = self::get($name);
            }
        }
        
        return $results;
    }
public static function getArrayFromPrefix($prefix)
    {
        self::assertEnvListAvailable();
        
        if (empty($prefix)) {
            throw new Exception(
                'You must provide a non-empty prefix to search for.',
                1496164608
            );
        }
        
        $results = [];
        
        foreach (array_keys($_ENV) as $name) {
            if (self::startsWith($name, $prefix)) {
                $nameAfterPrefix = substr($name, strlen($prefix));
                $results[$nameAfterPrefix] = self::get($name);
            }
        }
        
        return $results;
    }
public static function getArrayFromPrefix ( $ prefix ) { self :: assertEnvListAvailable ( ) ; if ( empty ( $ prefix ) ) { throw new Exception ( 'You must provide a non-empty prefix to search for.' , 1496164608 ) ; } $ results = [ ] ; foreach ( array_keys ( $ _ENV ) as $ name ) { if ( self :: startsWith ( $ name , $ prefix ) ) { $ nameAfterPrefix = substr ( $ name , strlen ( $ prefix ) ) ; $ results [ $ nameAfterPrefix ] = self :: get ( $ name ) ; } } return $ results ; }
Get an associative array of data, built from environment variables whose
names begin with the specified prefix (such as 'MY_DATA_'). If none are
found, an empty array will be returned.

Note that the prefix will NOT be included in the resulting array's key
names. See the tests for details.

The values 'true', 'false', and 'null' (case-insensitive) will be
converted to their non-string values. See Env::get().

@param string $prefix The prefix to look for, in the list of defined
environment variables' names. Must not be empty.
@return array
@throws EnvListNotAvailableException
@throws Exception
Get an associative array of data built from environment variables whose names begin with the specified prefix ( such as MY_DATA_ ) . If none are found an empty array will be returned .