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

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

glicer/link-checker
===================

Check broken links in html files, sitemap.xml and robots.txt

3113.7k8PHP

Since Jan 19Pushed 5y ago3 watchersCompare

[ Source](https://github.com/emmanuelroecker/php-linkchecker)[ Packagist](https://packagist.org/packages/glicer/link-checker)[ RSS](/packages/glicer-link-checker/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

php-linkchecker
===============

[](#php-linkchecker)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/e1d7f27257696fab0dd744290cac6acd4cc439b0a7a5e7baab617bf63ce81cb4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f656d6d616e75656c726f65636b65722f7068702d6c696e6b636865636b65722f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/emmanuelroecker/php-linkchecker/?branch=master)[![Build Status](https://camo.githubusercontent.com/0c3773db99fa9749b49cadd0a1251bd39dd576b77311d2ad6d11230a6d28798d/68747470733a2f2f7472617669732d63692e6f72672f656d6d616e75656c726f65636b65722f7068702d6c696e6b636865636b65722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/emmanuelroecker/php-linkchecker)[![Coverage Status](https://camo.githubusercontent.com/c7f5ea01fffb3cae95c4a2fcff4a863f7d4444d4ad5f7a618ce28be61fcfc60c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f656d6d616e75656c726f65636b65722f7068702d6c696e6b636865636b65722f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/emmanuelroecker/php-linkchecker?branch=master)[![SensioLabsInsight](https://camo.githubusercontent.com/9e300f92dcf0f09de72594d7fcf0eb419fa2352d7221315480c5aa0f0965b462/68747470733a2f2f696e73696768742e73656e73696f6c6162732e636f6d2f70726f6a656374732f34663633623134372d313932322d343532372d396430642d6533363933393761316331332f6d696e692e706e67)](https://insight.sensiolabs.com/projects/4f63b147-1922-4527-9d0d-e369397a1c13)

Check broken links in html / json files, sitemap.xml, markdown and robots.txt.

It's working with :

- [Guzzle](http://docs.guzzlephp.org)
- [Symfony Finder Component](http://symfony.com/doc/2.3/components/finder.html)
- [Glicer Simply-html Component](https://github.com/emmanuelroecker/php-simply-html)

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

[](#installation)

This library can be found on [Packagist](https://packagist.org/packages/glicer/link-checker).

The recommended way to install is through [composer](http://getcomposer.org).

Edit your `composer.json` and add :

```
{
    "require": {
       "glicer/link-checker": "dev-master"
    }
}
```

Install dependencies :

```
php composer.phar install
```

How to check links in html / json files ?
-----------------------------------------

[](#how-to-check-links-in-html--json-files-)

```
require 'vendor/autoload.php';

use GlLinkChecker\GlLinkChecker;
use GlLinkChecker\GlLinkCheckerReport;
use Symfony\Component\Finder\Finder;

//relative url use host http://lyon.glicer.com to check link
$linkChecker  = new GlLinkChecker('http://lyon.glicer.com');

//construct list of local html and json files to check
$finder = new Finder();
$files  = $finder->files()->in('./public')->name("*.html")->name("*.json");

//launch links checking
$result  = $linkChecker->checkFiles(
    $files,
    function ($nbr) {
        // called at beginning - $nbr urls to check
    },
    function ($url, $files) {
        // called each $url - $files : list of filename containing $url link
    },
    function () {
        // called at the end
    }
);

//convert $result array in a temp html file
$filereport = GlLinkCheckerReport::toTmpHtml('lyonCheck',$result);

//$filereport contain fullpath to html file
print_r($filereport);
```

you can view $filereport with your browser

How to check links in robots.txt and sitemap files ?
----------------------------------------------------

[](#how-to-check-links-in-robotstxt-and-sitemap-files-)

```
require 'vendor/autoload.php';

use GlLinkChecker\GlLinkChecker;

$linkChecker = new GlLinkChecker('http://lyon.glicer.com');
$result      = $linkChecker->checkRobotsSitemap();

print_r($result);
```

GlLinkChecker::checkRobotsSitemap() return an array like :

```
$result = [
    'disallow' =>
        ['error' => ['/img/', '/download/']],
    'sitemap'  =>
        [
            'ok' => [
                '/sitemap.xml' =>
                    [
                        'ok' =>
                            [
                                '/index.html',
                                '/section/probleme-solution/compresser-css-html-js.html'
                            ]
                    ]
            ]
        ]
];
```

Running Tests
-------------

[](#running-tests)

Launch from command line :

```
vendor\bin\phpunit
```

License MIT
-----------

[](#license-mit)

Contact
-------

[](#contact)

Authors : Emmanuel ROECKER &amp; Rym BOUCHAGOUR

[Web Development Blog - http://dev.glicer.com](http://dev.glicer.com)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/b48b243005db06852ef61705057d6bd36303e8e39d75191bb4c2c53c0823a2ea?d=identicon)[emmanuelroecker](/maintainers/emmanuelroecker)

---

Top Contributors

[![alesanchezr](https://avatars.githubusercontent.com/u/426452?v=4)](https://github.com/alesanchezr "alesanchezr (4 commits)")[![AshwinParmar](https://avatars.githubusercontent.com/u/725230?v=4)](https://github.com/AshwinParmar "AshwinParmar (1 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (1 commits)")

---

Tags

htmllinksphpphp-linkchecker

### Embed Badge

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

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

PHPackages © 2026

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