PHP Classes

PHP Link Checker: Extract and check links on a page

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not enough user ratingsTotal: 414 All time: 6,457 This week: 49Up
Version License PHP version Categories
link-check 1.0BSD License7HTML, Web services, PHP 7
Description 

Author

This class can extract and check links on a page.

It can retrieve the contents of a page with a given URL and extracts the links it contains.

The class can check if the links the page contains point to valid pages.

The results are outputted to a given output stream.

Innovation Award
PHP Programming Innovation award nominee
September 2017
Number 4
Many sites change over time. If the links they contain on their pages are not updated when the changes happen, the links will be broken.

This package can find broken links by traversing the pages of a site recursively and checking if the internal and external links still exist.

Manuel Lemos
Picture of Maik Greubel
  Performance   Level  
Name: Maik Greubel <contact>
Classes: 10 packages by
Country: Germany Germany
Age: ???
All time rank: 105967 in Germany Germany
Week rank: 304 Up17 in Germany Germany Up
Innovation award
Innovation award
Nominee: 4x

Recommendations

Link Checker
Find broken links in a Web site

Example

#!/usr/bin/env php
<?php
/*
 * This file is part of Nkey/LinkCheck.
 *
 * (c) Maik Greubel <greubel@nkey.de>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
require dirname(__FILE__) . '/vendor/autoload.php';

use
Nkey\LinkCheck\LinkCheckProvider;
use
Generics\Util\UrlParser;

if(
$argc < 2 ) {
    echo
$argv[0] . " {url} [recursive]";
}
else {
   
$provider = new LinkCheckProvider(UrlParser::parseUrl($argv[1]));
   
   
$options = [];

    if(
$argc == 3 && $argv[2] == 'recursive') {
       
$options['recursive'] = true;
    }
   
   
$provider->check($options);
}


Details

Build Status Code Coverage Scrutinizer Code Quality Requirements Status

link-check

Small php application which reads contents from an url, extract the links and checks them for existance


Screenshots (1)  
  • link-check-demo.png
  Files folder image Files (10)  
File Role Description
Files folder imagesrc (1 file)
Files folder imagetests (1 file)
Accessible without login Plain text file .scrutinizer.yml Data Auxiliary data
Accessible without login Plain text file .travis.yml Data Auxiliary data
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file link-check Example Example script
Accessible without login Plain text file phpunit.xml Data Auxiliary data
Accessible without login Plain text file README.md Data Auxiliary data

  Files folder image Files (10)  /  src  
File Role Description
  Plain text file LinkCheckProvider.php Class Class source

  Files folder image Files (10)  /  tests  
File Role Description
  Accessible without login Plain text file LinkCheckProviderTest.php Test Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 90%
Total:414
This week:0
All time:6,457
This week:49Up