public function load($dir, $env = null, $basename = 'config', $extension = 'yml')
    {
        $filepath = $dir . '/' . $basename . '.' . $extension;

        if (!file_exists($filepath)) {
            throw new \Exception(sprintf("Config file \"%s\" does not exist", $filepath));
        }

        $parameters = Yaml::parse($filepath);

        //Override configuration for a specific environment
        if ($env) {
            $filepath = $dir . '/' . $basename . '_' . $env . '.' . $extension;
            if (file_exists($filepath)) {
                $envParameters = Yaml::parse($filepath);
                if ($envParameters) {
                    $parameters = $this->deepMerge($parameters, $envParameters);
                }
            }
        }
        
        return $parameters;
    }