PHPackages                             hissezhaut/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. hissezhaut/laravel-link-checker

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

hissezhaut/laravel-link-checker
===============================

Check all links in a Laravel app

v2.0.1(9y ago)016MITPHPPHP ^5.5

Since Nov 16Pushed 9y ago1 watchersCompare

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

READMEChangelogDependencies (4)Versions (8)Used By (0)

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)[![SensioLabsInsight](https://camo.githubusercontent.com/9984139c33f6f6e97e44d39f4360b4b1f6614a377c21039e17bdae1ec330f4e8/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f31633365343561332d623839612d343333392d623065322d3730396466303535373034632e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/1c3e45a3-b89a-4339-b0e2-709df055704c)[![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).

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

[](#postcardware)

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

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

The best postcards will get published on the open source page on our website.

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,
];
```

You must register the `\Spatie\LinkChecker\CheckLinksCommand`:

```
// app/Console/Kernel.php
protected $commands = [
    ...
    \Spatie\LinkChecker\CheckLinksCommand::class,
];
```

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' => '',
        ],
    ],
];
```

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();
}
```

### 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 specify a class in the `default_profile`-option in the config file. The class must implement the `Spatie\Crawler\CrawlProfile`-interface:

```
interface CrawlProfile
{
    /**
     * Determine if the given url should be crawled.
     *
     * @param \Spatie\Crawler\Url $url
     *
     * @return bool
     */
    public function shouldCrawl(Url $url);
}
```

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 adhere to the `Spatie\Crawler\CrawlObserver`-interface:

```
interface CrawlObserver
{
    /**
     * Called when the crawler will crawl the url.
     *
     * @param \Spatie\Crawler\Url $url
     */
    public function willCrawl(Url $url);

    /**
     * Called when the crawler has crawled the given url.
     *
     * @param \Spatie\Crawler\Url                      $url
     * @param \Psr\Http\Message\ResponseInterface|null $response
     */
    public function hasBeenCrawled(Url $url, $response);

    /**
     * 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.

Change log
----------

[](#change-log)

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

Testing
-------

[](#testing)

First start the test server in a seperate 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.

Credits
-------

[](#credits)

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

About Spatie
------------

[](#about-spatie)

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).

License
-------

[](#license)

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

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.8% 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 ~64 days

Recently: every ~95 days

Total

7

Last Release

3445d ago

Major Versions

0.0.3 → 1.0.02015-11-25

1.0.1 → 2.0.02016-12-05

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

2.0.0PHP ^7.0

v2.0.1PHP ^5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/76fe096b68d1c2a3a92ec3dca380764e16fde837b05a9a5bfcee4fb4dfcf2173?d=identicon)[parweb](/maintainers/parweb)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (69 commits)")[![juukie](https://avatars.githubusercontent.com/u/2678657?v=4)](https://github.com/juukie "juukie (2 commits)")[![parweb](https://avatars.githubusercontent.com/u/174339?v=4)](https://github.com/parweb "parweb (1 commits)")

---

Tags

spatiehealthlinkcrawlercheckerlaravel-link-checker

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[spatie/crawler

Crawl all internal links found on a website

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

Create and generate sitemaps with ease

2.6k14.6M107](/packages/spatie-laravel-sitemap)[spatie/laravel-collection-macros

A set of useful Laravel collection macros

1.9k5.7M29](/packages/spatie-laravel-collection-macros)[spatie/laravel-cookie-consent

Make your Laravel app comply with the crazy EU cookie law

1.5k4.7M20](/packages/spatie-laravel-cookie-consent)[spatie/laravel-enum

Laravel Enum support

3655.4M31](/packages/spatie-laravel-enum)[spatie/laravel-multitenancy

Make your Laravel app usable by multiple tenants

1.3k2.9M16](/packages/spatie-laravel-multitenancy)

PHPackages © 2026

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