spatie / laravel-link-checker

Check all links in a Laravel application
https://murze.be/2015/11/a-package-to-check-all-links-in-a-laravel-app/
MIT License
259 stars 45 forks source link

How to pass parameter to profile? #34

Closed Tropicalista closed 6 years ago

Tropicalista commented 6 years ago

Let's say I want to use this profile:

namespace Spatie\Crawler;
use GuzzleHttp\Psr7\Uri;
use Psr\Http\Message\UriInterface;
class CrawlInternalUrls implements CrawlProfile
{
    protected $baseUrl;
    public function __construct($baseUrl)
    {
        if (! $baseUrl instanceof UriInterface) {
            $baseUrl = new Uri($baseUrl);
        }
        $this->baseUrl = $baseUrl;
    }
    public function shouldCrawl(UriInterface $url): bool
    {
        return $this->baseUrl->getHost() === $url->getHost();
    }
}

how can I pass the parameter to the constructor?

freekmurze commented 6 years ago
$baseUrl = 'yourUrl';
$crawlProfile = new CrawlProfile($baseUrl);
Tropicalista commented 6 years ago

I mean using this package I should call it php artisan link-checker:run --url=https://laravel.com how to pass the url to the profile to check only internal link?

spatie-bot commented 6 years ago

Dear contributor,

because this issue seems to be inactive for quite some time now, I've automatically closed it. If you feel this issue deserves some attention from my human colleagues feel free to reopen it.