public static function createFromUrl($url)
    {
        $url = (string) $url;
        $url = trim($url);
        $original_url = $url;
        $url = self::sanitizeUrl($url);

        //if no valid scheme is found we add one
        if (is_null($url)) {
            throw new RuntimeException(sprintf('The given URL: `%s` could not be parse', $original_url));
        }

        $components = array_merge(array(
            'scheme' => null,
            'user' => null,
            'pass' => null,
            'host' => null,
            'port' => null,
            'path' => null,
            'query' => null,
            'fragment' => null,
        ), self::parseUrl($url));
        $components = self::formatAuthComponent($components);
        $components = self::formatPathComponent($components, $original_url);

        return new static(
            new Components\Scheme($components['scheme']),
            new Components\User($components['user']),
            new Components\Pass($components['pass']),
            new Components\Host($components['host']),
            new Components\Port($components['port']),
            new Components\Path($components['path']),
            new Components\Query($components['query']),
            new Components\Fragment($components['fragment'])
        );
    }