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

ActiveLibrary

rs/link-checker
===============

Visits links and checks they are still working. Also tries to return the title of html pages and pdfs.

v1.0.0(10mo ago)01MITPHPPHP ^8.3CI passing

Since Jul 18Pushed 2mo agoCompare

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

READMEChangelogDependencies (6)Versions (3)Used By (0)

Laravel Link Checker
====================

[](#laravel-link-checker)

A robust and flexible package for checking the status of URLs within your Laravel application. It concurrently checks a list of URLs, follows redirects, and intelligently extracts page titles from both HTML pages and PDF documents.

PDF title extraction is handled via a configurable AWS Lambda function, allowing for powerful, serverless processing of PDF metadata. The package is designed with a clean, extensible architecture, making it easy to add new title extraction strategies in the future.

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require rs/link-checker
```

Configuration
-------------

[](#configuration)

First, publish the configuration file to your application's `config` directory:

```
php artisan vendor:publish --provider="RedSnapper\LinkChecker\LinkCheckerServiceProvider" --tag="link-checker-config"
```

This will create a `config/link-checker.php` file.

### PDF Title Extraction (Optional)

[](#pdf-title-extraction-optional)

To enable title extraction from PDF documents, you must configure your AWS credentials and specify the ARN of your deployed Lambda function in your `.env` file.

The package will automatically use the official AWS SDK for PHP, which looks for credentials in the following order:

1. IAM Role (Recommended for production environments like EC2 or ECS)
2. Environment variables

```
# .env

# Your default AWS region
AWS_REGION=eu-west-1

# Credentials (only needed if not using an IAM Role)
AWS_ACCESS_KEY_ID=your_access_key
AWS_SECRET_ACCESS_KEY=your_secret_key

# The full ARN of your PDF Title Extractor Lambda function
AWS_PDF_TITLE_LAMBDA_ARN=arn:aws:lambda:us-east-1:123456789012:function:PdfTitleExtractor
```

If `AWS_PDF_TITLE_LAMBDA_ARN` is not set, the package will gracefully skip PDF title extraction without causing errors.

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

You can use the `LinkChecker` facade to check an array of URLs. The `check` method returns a `Collection` of `LinkCheckResult` objects.

```
use RedSnapper\LinkChecker\Facades\LinkChecker;

$urls = [
    '[https://www.google.com](https://www.google.com)', // Will extract HTML title
    '[https://example.com/document.pdf](https://example.com/document.pdf)', // Will extract PDF title (if configured)
    '[https://example.com/broken-link](https://example.com/broken-link)', // Will report a 404 error
];

$results = LinkChecker::check($urls);

foreach ($results as $result) {
    echo "URL: " . $result->originalUrl . "\n";
    echo "Status: " . $result->status . "\n"; // e.g., 'ok', 'client_error'
    echo "Status Code: " . $result->statusCode . "\n"; // e.g., 200, 404
    echo "Title: " . $result->title . "\n"; // e.g., 'Google', 'My Awesome PDF Title'
    echo "Error: " . $result->errorMessage . "\n\n";
}
```

### Using Dependency Injection

[](#using-dependency-injection)

For developers who prefer dependency injection over facades, you can type-hint the `LinkCheckerInterface` in your class constructor or method. Laravel's service container will automatically resolve the correct implementation.

```
use RedSnapper\LinkChecker\Contracts\LinkCheckerInterface;

class YourService
{
    protected $linkChecker;

    public function __construct(LinkCheckerInterface $linkChecker)
    {
        $this->linkChecker = $linkChecker;
    }

    public function checkSomeLinks()
    {
        $urls = ['[https://example.com](https://example.com)'];

        $results = $this->linkChecker->check($urls);

        // ... do something with the results
    }
}
```

### Passing Custom Options

[](#passing-custom-options)

The `check` method accepts an optional second argument for custom options, such as headers and a referrer. These options will be used for both the initial URL check and will be passed to the PDF extractor Lambda for maximum authenticity.

```
use RedSnapper\LinkChecker\Facades\LinkChecker;

$pageUrl = '[https://www.my-client.com/links-page](https://www.my-client.com/links-page)';
$pdfUrl = '[https://example.com/document.pdf](https://example.com/document.pdf)';

$results = LinkChecker::check(
    [$pdfUrl],
    [
        'referrer' => $pageUrl,
        'headers' => ['X-Custom-Request-ID' => '12345-abcde']
    ]
);

// The Lambda function will be invoked with both the Referer and X-Custom-Request-ID headers.
```

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

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

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.

License
-------

[](#license)

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

###  Health Score

35

—

LowBetter than 80% of packages

Maintenance71

Regular maintenance activity

Popularity1

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.9% 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

Unknown

Total

1

Last Release

304d ago

### Community

Maintainers

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

---

Top Contributors

[![paramdhal](https://avatars.githubusercontent.com/u/1278858?v=4)](https://github.com/paramdhal "paramdhal (8 commits)")[![joeuk89](https://avatars.githubusercontent.com/u/6736852?v=4)](https://github.com/joeuk89 "joeuk89 (1 commits)")

---

Tags

link-checkerrs

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

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

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

###  Alternatives

[league/flysystem-aws-s3-v3

AWS S3 filesystem adapter for Flysystem.

1.6k263.6M790](/packages/league-flysystem-aws-s3-v3)[aws/aws-sdk-php-laravel

A simple Laravel 9/10/11/12/13 service provider for including the AWS SDK for PHP.

1.7k35.6M75](/packages/aws-aws-sdk-php-laravel)[humanmade/s3-uploads

WordPress plugin to store uploads on S3

2.1k2.4M9](/packages/humanmade-s3-uploads)[bref/laravel-bridge

An advanced Laravel integration for Bref, including Octane support.

3384.1M11](/packages/bref-laravel-bridge)[magento/magento2-functional-testing-framework

Magento2 Functional Testing Framework

15511.5M30](/packages/magento-magento2-functional-testing-framework)

PHPackages © 2026

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