{"id":33997097,"url":"https://github.com/rvalitov/backlink-checker-php","last_synced_at":"2025-12-13T08:53:37.350Z","repository":{"id":37548274,"uuid":"152859969","full_name":"rvalitov/backlink-checker-php","owner":"rvalitov","description":"Validates a predefined list of backlinks on remote websites that they exist and are correct (for SEO). Simple and Javascript-enabled web engines are used for scraping.","archived":false,"fork":false,"pushed_at":"2025-11-15T10:44:04.000Z","size":507,"stargazers_count":57,"open_issues_count":5,"forks_count":19,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-11-27T16:27:26.005Z","etag":null,"topics":["backlinks","seo","seo-tools","seotools"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rvalitov.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"rvalitov","custom":["https://donations.walitoff.com"]}},"created_at":"2018-10-13T10:16:43.000Z","updated_at":"2025-11-19T15:31:56.000Z","dependencies_parsed_at":"2022-08-02T02:20:06.874Z","dependency_job_id":"6e0eedd5-9d1a-4249-ba8c-f7a8b399ed7a","html_url":"https://github.com/rvalitov/backlink-checker-php","commit_stats":{"total_commits":20,"total_committers":3,"mean_commits":6.666666666666667,"dds":"0.30000000000000004","last_synced_commit":"6925bdbcd27ae101ec27b58e1fbacfb45a8959ef"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/rvalitov/backlink-checker-php","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvalitov%2Fbacklink-checker-php","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvalitov%2Fbacklink-checker-php/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvalitov%2Fbacklink-checker-php/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvalitov%2Fbacklink-checker-php/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rvalitov","download_url":"https://codeload.github.com/rvalitov/backlink-checker-php/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rvalitov%2Fbacklink-checker-php/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27702793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-13T02:00:09.769Z","response_time":147,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backlinks","seo","seo-tools","seotools"],"created_at":"2025-12-13T08:53:36.684Z","updated_at":"2025-12-13T08:53:37.332Z","avatar_url":"https://github.com/rvalitov.png","language":"PHP","funding_links":["https://github.com/sponsors/rvalitov","https://donations.walitoff.com"],"categories":[],"sub_categories":[],"readme":"# Backlink Validator for SEO\n\n![PHP version icon](https://img.shields.io/static/v1?label=PHP\u0026message=7.4%20-%208.4%20\u0026color=blue)\n![Platform icon](https://img.shields.io/badge/Platform-Windows%2C%20Linux%2C%20Mac-blue)\n![Packagist Downloads](https://img.shields.io/packagist/dt/rvalitov/backlink-checker-php)\n![Packagist Stars](https://img.shields.io/packagist/stars/rvalitov/backlink-checker-php)\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/328e8eae9a494098b8a8ee66d602f781)](https://app.codacy.com/gh/rvalitov/backlink-checker-php/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_coverage)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/328e8eae9a494098b8a8ee66d602f781)](https://app.codacy.com/gh/rvalitov/backlink-checker-php/dashboard?utm_source=gh\u0026utm_medium=referral\u0026utm_content=\u0026utm_campaign=Badge_grade)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=rvalitov_backlink-checker-php\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=rvalitov_backlink-checker-php)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=rvalitov_backlink-checker-php\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=rvalitov_backlink-checker-php)\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=rvalitov_backlink-checker-php\u0026metric=security_rating)](https://sonarcloud.io/summary/new_code?id=rvalitov_backlink-checker-php)\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=rvalitov_backlink-checker-php\u0026metric=bugs)](https://sonarcloud.io/summary/new_code?id=rvalitov_backlink-checker-php)\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=rvalitov_backlink-checker-php\u0026metric=vulnerabilities)](https://sonarcloud.io/summary/new_code?id=rvalitov_backlink-checker-php)\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=rvalitov_backlink-checker-php\u0026metric=reliability_rating)](https://sonarcloud.io/summary/new_code?id=rvalitov_backlink-checker-php)\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=rvalitov_backlink-checker-php\u0026metric=sqale_index)](https://sonarcloud.io/summary/new_code?id=rvalitov_backlink-checker-php)\n[![Tests](https://github.com/rvalitov/backlink-checker-php/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/rvalitov/backlink-checker-php/actions/workflows/tests.yml)\n![GitHub License](https://img.shields.io/github/license/rvalitov/backlink-checker-php?color=blue)\n\n![Social preview](media/social-preview.jpg)\n\nThis project is a package for developers to validate backlinks in SEO.\nUnlike other tools that scan the Internet or analyze Google Search results to find backlinks,\nour tool focuses exclusively on verifying backlinks from a list you already have.\n\nYou might get this list of backlinks through:\n\n* **Purchasing backlinks**: Receiving a list of donor web pages from the seller or backlinks market.\n* **Creating backlinks yourself**: Posting on forums, third-party websites, or other platforms.\n* **SEO service providers**: your SEO expert or company shares a reports with backlinks as one of the SEO strategies.\n\nOnce you have a list of donor web pages, it's crucial to confirm that the backlinks are present and functional.\nMoreover, ongoing validation is necessary to ensure the backlinks remain active and haven’t been removed over time.\n\nThis package simplifies backlink checking and verification by:\n\n* Verifying the presence of fixed backlinks, such as `https://example.com`.\n* Supporting powerful search patterns, like `*.example.com`, using\n  [regular expressions](https://en.wikipedia.org/wiki/Regular_expression) defined by you.\n\nWith this package, monitoring and maintaining your backlinks becomes efficient and hassle-free.\n\n## Browser Scraping Modes\n\n### Simple\n\nPros:\n\n* **Fast**: Simple mode is faster.\n* **Low resource consumption**: Simple mode uses fewer resources.\n* **Minimal dependencies**: Simple mode requires fewer dependencies.\n* **Shared hosting**: Simple mode works on shared hosting.\n\nCons:\n\n* **No JavaScript**: Simple mode does not support JavaScript,\n  so it works only for simple or static HTML, for example, generated by Joomla, WordPress or Drupal.\n  It will not find backlinks on websites that require JavaScript-enabled browser,\n  for example, websites made with Laravel, Yii, React, etc.\n\n### Chromium\n\nThe [Chromium headless mode](https://developers.google.com/web/updates/2017/04/headless-chrome) is used\nfor JavaScript-enabled browsing.\nThis approach allows parsing any website, and this is the universal mode,\nbut it uses more resources on the server and requires a little bit more time to configure the server.\n\nPros:\n\n* **Universal**: Chromium mode supports JavaScript, so it can parse any website.\n\nCons:\n\n* **Slower**: Chromium mode is slower.\n* **Higher resource consumption**: Chromium mode uses more resources.\n* **Advanced hosting plan**: requires a VPS or dedicated server, does not work on shared hosting.\n\n## How to Install\n\n### Step 1. Add the Package via Composer\n\nYou must have a [Composer](https://getcomposer.org/) installed.\nRun the following command:\n\n```bash\nphp composer require rvalitov/backlink-checker-php\n```\n\nRequired PHP extensions:\n\n* [`json`](https://www.php.net/manual/en/json.installation.php)\n* [`sockets`](https://www.php.net/manual/en/sockets.installation.php)\n\n### Step 2. Install the Chromium\n\n**Note:** You can skip this step if you don't need the Chromium mode.\n\nYou need to install the following packages first, to make the Chromium work.\n\n**For Debian/Ubuntu:**\n\n```bash\napt-get update\napt-get install gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget\n```\n\nYou must have a [Node.js](https://nodejs.org/) installed.\nIf it's not installed, install it using the official manual.\n\nIf you use PHP 8.0 or later, you need to install the following package:\n\n```bash\nnpm install https://github.com/zoonru/rialto\n```\n\nIf you use PHP 7.4, you need to install the following package:\n\n```bash\nnpm install @nesk/rialto \n```\n\n### Step 3. Use Autoload\n\nInclude the `autoload.php` in your source PHP file, for example:\n\n```php\n\u003c?php\nrequire __DIR__ . '/vendor/autoload.php';\n```\n\n## How to Use\n\nFirst, include the dependencies:\n\n```php\n\u003c?php\nrequire __DIR__ . \"/vendor/autoload.php\";\n\nuse Valitov\\BacklinkChecker;\n```\n\nThen decide which mode to use, for Chromium mode use:\n\n```php\n$checker = new BacklinkChecker\\ChromeBacklinkChecker();\n```\n\nOr if you want a simple mode without JavaScript support use:\n\n```php\n$checker = new BacklinkChecker\\SimpleBacklinkChecker();\n```\n\nMake a scan of the desired URL with a desired pattern\n(use the [PCRE pattern syntax](http://php.net/manual/en/reference.pcre.pattern.syntax.php)):\n\n```php\n$url = \"https://example.com\";\n$pattern = \"@https?://(www\\.)?website\\.com.*@\";\n$scanBacklinks = true;\n$scanHotlinks = false;\n$makeScreenshot = true;\n\ntry {\n    $result = $checker-\u003egetBacklinks($url, $pattern, $scanBacklinks, $scanHotlinks, $makeScreenshot);\n} catch (\\Exception $e) {\n    die(\"Error: \" . $e-\u003egetMessage());\n}\n```\n\nThe function `getBacklinks` has the following additional options:\n\n* `$scanBacklinks` - if set to `true`,\n  then it scans for the backlinks\n  (the text of the `href` attribute of [`\u003ca\u003e`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/a) tag);\n  otherwise scanning is not performed.\n* `$scanHotlinks` - if set to `true`, then it scans for the [hotlink](https://simple.wikipedia.org/wiki/Hotlinking) (the\n  text of the `src` attribute of [`\u003cimg\u003e`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/img) tag);\n  otherwise scanning is not performed.\n* `$makeScreenshot` - if set to `true`, then we also take a screenshot of the viewport; otherwise screenshot is not\n  made.\n  This option makes sense only for Chromium mode (default viewport size is `800 x 600` px, image format: `JPEG`,\n  image quality: `90`, image encoding: `binary`); for simple mode this option is ignored.\n\nNow we should check the `$result`, if the function succeeded:\n\n```php\n$response = $result-\u003egetResponse();\nif ($response-\u003eisSuccess()) {\n    $links = $result-\u003egetBacklinks();\n    if (sizeof($links) \u003e 0)\n        //Backlinks found\n    else {\n        //No backlinks found\n    }\n} else {\n    //Error, usually network error, or server error\n    die(\"Error, HTTP Code \" . $response-\u003egetStatusCode());\n}\n```\n\nThe function `$result-\u003egetBacklinks()` returns an array of objects that describe the backlink. Each object supports the\nfollowing functions:\n\n* `getBacklink` returns `string`, a backlink - an exact URL that matches the target domain;\n* `getTag` returns `string`, the tag that is used for the backlink, can be `a` or `img`;\n* `getTarget` returns `string`, contents of\n  [`target`](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/A#attr-target) attribute of the `href`;\n* `getNoFollow` returns `true` if the backlink has [`nofollow`](https://en.wikipedia.org/wiki/Nofollow) attribute;\n* `getAnchor` returns `string` - anchor of the link, for example, inner text of `\u003ca\u003e` tag. This text is returned in a\n  plain text format, all HTML tags are stripped.\n\nThe `$response` object supports the following functions:\n\n* `getUrl` returns `string`, the URL of that was analyzed\n* `getStatusCode` returns `int`, the [HTTP status code](https://en.wikipedia.org/wiki/List_of_HTTP_status_codes), or `0`\n  or `-1` if there was a network error.\n* `getScreenshot` returns `string`, the screenshot in binary format. If the screenshot was not taken or is not\n  available, then the string is empty. If you want to display this screenshot as an image on a web page, then you should\n  first save it to disk and use a link to it, or encode it into [base64](https://en.wikipedia.org/wiki/Data_URI_scheme)\n  and insert into the web page directly. In this case, you can use a function like:\n\n```php\n$base64_image = \"data:image/jpeg;base64,\" . base64_encode($response-\u003egetScreenshot());\n```\n\n**Note**. If you use function [`json_encode`](http://php.net/manual/en/function.json-encode.php) on an object that\ncontains the screenshot, then this screenshot will be converted\nto [base64](https://en.wikipedia.org/wiki/Data_URI_scheme) format automatically.\n\n## Examples\n\nExamples are available in a dedicated project on [GitHub](https://github.com/rvalitov/backlink-checker-php-demo).\nTests are in `tests` folder.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvalitov%2Fbacklink-checker-php","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frvalitov%2Fbacklink-checker-php","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frvalitov%2Fbacklink-checker-php/lists"}