All Projects β†’ emmanuelroecker β†’ php-linkchecker

emmanuelroecker / php-linkchecker

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

Programming Languages

PHP
23972 projects - #3 most used programming language
HTML
75241 projects

Projects that are alternatives of or similar to php-linkchecker

links-to-free-online-courses
πŸ“– Free online courses resources.
Stars: ✭ 51 (+112.5%)
Mutual labels:  links
tg-inviter
Generate personal invite links for Telegram channels
Stars: ✭ 26 (+8.33%)
Mutual labels:  links
tech-resources
πŸ”§ A list of useful resources for tech enthusiasts. https://andou.github.io/tech-resources/
Stars: ✭ 25 (+4.17%)
Mutual labels:  links
Links
A responsive webpage for putting all our links in. A substitute for linktree created using HTML, CSS and JS using custom admin dashboard.
Stars: ✭ 18 (-25%)
Mutual labels:  links
KGrabber
Userscript for extracting links from kissanime.ru and similar sites.
Stars: ✭ 29 (+20.83%)
Mutual labels:  links
data-resources
Collection of resources I've found to be helpful for data science and programming
Stars: ✭ 65 (+170.83%)
Mutual labels:  links
nanolinks
A curated link guide for finding anything about Nano; The fast, fee-less and green digital currency!
Stars: ✭ 25 (+4.17%)
Mutual labels:  links
Data-Science-and-Machine-Learning-Resources
List of Data Science and Machine Learning Resource that I frequently use
Stars: ✭ 19 (-20.83%)
Mutual labels:  links
robustlinks
Links on the web break all the time, robustify them!
Stars: ✭ 40 (+66.67%)
Mutual labels:  links
resources
Curated list of resources for various topics, articles, tutorials, etc I've found useful.
Stars: ✭ 16 (-33.33%)
Mutual labels:  links
vue-link
One component to link them all πŸ”—
Stars: ✭ 65 (+170.83%)
Mutual labels:  links
youtube-playlist
❄️ Extract links, ids, and names from a youtube playlist
Stars: ✭ 73 (+204.17%)
Mutual labels:  links
linkcast
Share links, images, blogs and everything on the web with your friends in one click using this chrome extension Linkcast
Stars: ✭ 13 (-45.83%)
Mutual labels:  links
links
A Beautiful Jekyll Theme For Links
Stars: ✭ 84 (+250%)
Mutual labels:  links
tgrm.github.io
Аналог t.me Ρ‡Π΅Ρ€Π΅Π· github pages
Stars: ✭ 62 (+158.33%)
Mutual labels:  links
fleeg-platform
Fleeg is a free and open source platform to index and search pages.
Stars: ✭ 21 (-12.5%)
Mutual labels:  links
links-uteis
πŸ“Ž A curated list of awesome project development links
Stars: ✭ 2,547 (+10512.5%)
Mutual labels:  links
quill-magic-url
Automatically convert URLs to links in Quill
Stars: ✭ 86 (+258.33%)
Mutual labels:  links
scam-links
Collection of phishing and malicious links that focuses on Steam and Discord scams.
Stars: ✭ 118 (+391.67%)
Mutual labels:  links
iOS-Tweak-Dev-Tools
A collection of useful development tools and forks of tools that are geared towards iOS jailbreak developers.
Stars: ✭ 37 (+54.17%)
Mutual labels:  links

php-linkchecker

Scrutinizer Code Quality Build Status Coverage Status SensioLabsInsight

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

It's working with :

Installation

This library can be found on Packagist.

The recommended way to install is through composer.

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 ?

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 ?

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

Launch from command line :

vendor\bin\phpunit

License MIT

Contact

Authors : Emmanuel ROECKER & Rym BOUCHAGOUR

Web Development Blog - http://dev.glicer.com

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].