PHPackages                             spatie/laravel-link-checker - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. spatie/laravel-link-checker

Abandoned → [https://ohdear.app](/?search=https%3A%2F%2Fohdear.app)ArchivedLibrary[Utility &amp; Helpers](/categories/utility)

spatie/laravel-link-checker
===========================

Check all links in a Laravel app

4.3.0(3y ago)25853.0k421MITPHPPHP ^7.2|^8.0

Since Nov 16Pushed 3y ago10 watchersCompare

[ Source](https://github.com/spatie/laravel-link-checker)[ Packagist](https://packagist.org/packages/spatie/laravel-link-checker)[ Docs](https://github.com/spatie/laravel-link-checker)[ RSS](/packages/spatie-laravel-link-checker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (26)Used By (1)

**THIS PACKAGE IS NOT MAINTAINED ANYMORE**

Check all links in a Laravel app
================================

[](#check-all-links-in-a-laravel-app)

[![Latest Version on Packagist](https://camo.githubusercontent.com/2378609bba5e6faabd0a3d12f54f69c64abaec9a26805276d236c848e171500e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d6c696e6b2d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-link-checker)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/d6feecd6ddc49cf7a6747beb3113c90bf798e30734d9f5056345256ea4a15ce7/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f7370617469652f6c61726176656c2d6c696e6b2d636865636b65722f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/spatie/laravel-link-checker)[![StyleCI](https://camo.githubusercontent.com/ea13958f9cfe978cbfc0fb68c4e35a48ffb22add07707186e5539834b96630a7/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f34353633393635352f736869656c643f6272616e63683d6d6173746572)](https://github.styleci.io/repos/45639655)[![Quality Score](https://camo.githubusercontent.com/d2bf977adc6a2c0a6237d0e3da48238a6cd3cb256797d68cbceb7d105ecd138b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f672f7370617469652f6c61726176656c2d6c696e6b2d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://scrutinizer-ci.com/g/spatie/laravel-link-checker)[![Total Downloads](https://camo.githubusercontent.com/ea1501a2be2a66a97602a1d1c5bf1346950a135340594710069c7d6134511cbd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d6c696e6b2d636865636b65722e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-link-checker)

This package provides a command that can check all links on your laravel app. By default, it will log all links that do not return a status code in the 200- or 300-range. There's also an option to mail broken links.

If you like this package, take a look at [the other ones we have made](https://spatie.be/opensource/laravel).

Install
-------

[](#install)

You can install the package via composer:

```
composer require spatie/laravel-link-checker
```

Next, you must install the service provider:

```
// config/app.php
'providers' => [
    ...
    Spatie\LinkChecker\LinkCheckerServiceProvider::class,
];
```

The service provider will automatically be registered.

You can optionally publish the config-file with:

```
php artisan vendor:publish --provider="Spatie\LinkChecker\LinkCheckerServiceProvider" --tag="config"
```

This is the contents of the published config file:

```
return [

    /*
     * The base url of your app. Leave this empty to use
     * the url configured in config/app.php
     */
    'url' => '',

    /*
     * The profile determines which links need to be checked.
     */
    'default_profile' => Spatie\LinkChecker\CheckAllLinks::class,

    /*
     * The reporter determines what needs to be done when the
     * the crawler has visited a link.
     */
    'default_reporter' => Spatie\LinkChecker\Reporters\LogBrokenLinks::class,

    /*
     * To speed up the checking process we'll fire off requests concurrently.
     * Here you can change the amount of concurrent requests.
     */
    'concurrency' => 10

    /*
     *  Here you can specify configuration regarding the used reporters
     */
    'reporters' => [

        'mail' => [

            /*
             * The `from` address to be used by the mail reporter.
             */
            'from_address' => '',

            /*
             * The `to` address to be used by the mail reporter.
             */
            'to_address' => '',

            /*
             * The subject line to be used by the mail reporter.
             */
            'subject' => '',
        ],

        /*
         * If you wish to exclude status codes from the reporters,
         * you can select the status codes that you wish to
         * exclude in the array below like: [200, 302]
         */
        'exclude_status_codes' => [],
    ],
];
```

Usage
-----

[](#usage)

You can start checking all links by issuing this command:

```
php artisan link-checker:run
```

Want to run the crawler on a different url? No problem!

```
php artisan link-checker:run --url=https://laravel.com
```

### Schedule the command

[](#schedule-the-command)

To frequently check all links you can schedule the command:

```
// app/console/Kernel.php

protected function schedule(Schedule $schedule)
{
    ...
    $schedule->command('link-checker:run')->sundays()->daily();
}
```

### Mail broken links

[](#mail-broken-links)

By default the package will log all broken links. If you want to have them mailed instead, just specify `Spatie\LinkChecker\Reporters\MailBrokenLinks` in the `default_reporter` option in the config file.

Creating your own crawl profile
-------------------------------

[](#creating-your-own-crawl-profile)

A crawlprofile determines which links need to be crawled. By default `Spatie\LinkChecker\CheckAllLinks` is used, which will check all links it finds. This behaviour can be customized by specifying a class in the `default_profile`-option in the config file. The class must extend the abstract class `Spatie\Crawler\CrawlProfile`:

```
abstract class CrawlProfile
{
    /**
     * Determine if the given url should be crawled.
     *
     * @param \Psr\Http\Message\UriInterface $url
     *
     * @return bool
     */
    abstract public function shouldCrawl(UriInterface $url): bool;
}
```

Creating your own reporter
--------------------------

[](#creating-your-own-reporter)

A reporter determines what should be done when a link is crawled and when the crawling process is finished. This package provides two reporters: `Spatie\LinkChecker\Reporters\LogBrokenLinks` and `Spatie\LinkChecker\Reporters\MailBrokenLinks`. You can create your own behaviour by making a class extend the abstract class `Spatie\Crawler\CrawlObserver`:

```
abstract class CrawlObserver
{
    /**
     * Called when the crawler will crawl the url.
     *
     * @param \Psr\Http\Message\UriInterface $url
     */
    public function willCrawl(UriInterface $url)
    {
    }

    /**
     * Called when the crawler has crawled the given url successfully.
     *
     * @param \Psr\Http\Message\UriInterface $url
     * @param \Psr\Http\Message\ResponseInterface $response
     * @param \Psr\Http\Message\UriInterface|null $foundOnUrl
     */
    abstract public function crawled(
        UriInterface $url,
        ResponseInterface $response,
        ?UriInterface $foundOnUrl = null
    );

    /**
     * Called when the crawler had a problem crawling the given url.
     *
     * @param \Psr\Http\Message\UriInterface $url
     * @param \GuzzleHttp\Exception\RequestException $requestException
     * @param \Psr\Http\Message\UriInterface|null $foundOnUrl
     */
    abstract public function crawlFailed(
        UriInterface $url,
        RequestException $requestException,
        ?UriInterface $foundOnUrl = null
    );

    /**
     * Called when the crawl has ended.
     */
    public function finishedCrawling()
    {
    }
}
```

To make it easier to create a reporter, you can extend `Spatie\LinkChecker\Reporters\BaseReporter` which provides many useful methods.

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

First, start the test server in a separate terminal session:

```
cd tests/server
./start_server.sh
```

With the server running you can execute the tests

```
composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Postcardware
------------

[](#postcardware)

You're free to use this package (it's [MIT-licensed](LICENSE.md)), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.

Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.

All postcards are published [on our website](https://spatie.be/en/opensource/postcards).

Credits
-------

[](#credits)

- [Freek Van der Herten](https://github.com/freekmurze)
- [All Contributors](../../contributors)

Support us
----------

[](#support-us)

Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects [on our website](https://spatie.be/opensource).

Does your business depend on our contributions? Reach out and support us on [Patreon](https://www.patreon.com/spatie). All pledges will be dedicated to allocating workforce on maintenance and new awesome stuff.

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

46

—

FairBetter than 93% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community29

Small or concentrated contributor base

Maturity78

Established project with proven stability

 Bus Factor1

Top contributor holds 75.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~109 days

Recently: every ~441 days

Total

25

Last Release

1216d ago

Major Versions

1.0.4 → 2.0.12017-01-19

1.1.0 → 2.1.02017-09-27

v1.x-dev → 2.2.02017-09-29

2.4.0 → 3.0.02018-02-12

3.0.0 → 4.0.02018-03-20

PHP version history (5 changes)0.0.1PHP &gt;=5.5.0

2.0.0PHP ^7.0

3.0.0PHP ^7.1

4.2.0PHP ^7.2

4.3.0PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (96 commits)")[![brendt](https://avatars.githubusercontent.com/u/6905297?v=4)](https://github.com/brendt "brendt (8 commits)")[![rubenvanassche](https://avatars.githubusercontent.com/u/619804?v=4)](https://github.com/rubenvanassche "rubenvanassche (5 commits)")[![juukie](https://avatars.githubusercontent.com/u/2678657?v=4)](https://github.com/juukie "juukie (4 commits)")[![marktopper](https://avatars.githubusercontent.com/u/2232539?v=4)](https://github.com/marktopper "marktopper (2 commits)")[![eduarguz](https://avatars.githubusercontent.com/u/14934055?v=4)](https://github.com/eduarguz "eduarguz (1 commits)")[![jannejava](https://avatars.githubusercontent.com/u/543616?v=4)](https://github.com/jannejava "jannejava (1 commits)")[![laravel-shift](https://avatars.githubusercontent.com/u/15991828?v=4)](https://github.com/laravel-shift "laravel-shift (1 commits)")[![m1guelpf](https://avatars.githubusercontent.com/u/23558090?v=4)](https://github.com/m1guelpf "m1guelpf (1 commits)")[![robindirksen1](https://avatars.githubusercontent.com/u/22446895?v=4)](https://github.com/robindirksen1 "robindirksen1 (1 commits)")[![RobLui](https://avatars.githubusercontent.com/u/10846766?v=4)](https://github.com/RobLui "RobLui (1 commits)")[![akoepcke](https://avatars.githubusercontent.com/u/5311185?v=4)](https://github.com/akoepcke "akoepcke (1 commits)")[![sunscreem](https://avatars.githubusercontent.com/u/7523595?v=4)](https://github.com/sunscreem "sunscreem (1 commits)")[![arubacao](https://avatars.githubusercontent.com/u/7462542?v=4)](https://github.com/arubacao "arubacao (1 commits)")[![caiquecastro](https://avatars.githubusercontent.com/u/3316550?v=4)](https://github.com/caiquecastro "caiquecastro (1 commits)")[![chapeupreto](https://avatars.githubusercontent.com/u/834048?v=4)](https://github.com/chapeupreto "chapeupreto (1 commits)")[![cmizzi](https://avatars.githubusercontent.com/u/340143?v=4)](https://github.com/cmizzi "cmizzi (1 commits)")

---

Tags

artisanlaravelphpseospatiehealthlinkcrawlercheckerlaravel-link-checker

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/spatie-laravel-link-checker/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-laravel-link-checker/health.svg)](https://phpackages.com/packages/spatie-laravel-link-checker)
```

###  Alternatives

[spatie/crawler

Crawl all internal links found on a website

2.8k16.3M52](/packages/spatie-crawler)[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[spatie/laravel-missing-page-redirector

Redirect missing pages in your Laravel application

5071.4M15](/packages/spatie-laravel-missing-page-redirector)[spatie/laravel-stubs

Opinionated Laravel stubs

252616.9k3](/packages/spatie-laravel-stubs)[spatie/mixed-content-scanner

Scan your site for mixed content

10438.5k3](/packages/spatie-mixed-content-scanner)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
