/** * 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); }); }