Spatie\Crawler\Url::create PHP Method

create() public static method

public static create ( $url ) : static
$url
return static
    public static function create($url)
    {
        return new static($url);
    }

Same methods

Url::create ( string $url ) : static

Usage Example

Example #1
0
 /**
  * Get all links in the given html.
  *
  * @param string $html
  *
  * @return \Spatie\Crawler\Url[]
  */
 protected function getAllLinks($html)
 {
     $domCrawler = new DomCrawler($html);
     return collect($domCrawler->filterXpath('//a')->extract(['href']))->map(function ($url) {
         return Url::create($url);
     });
 }