Download the PHP package rvalitov/backlink-checker-php without Composer
On this page you can find all versions of the php package rvalitov/backlink-checker-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download rvalitov/backlink-checker-php
More information about rvalitov/backlink-checker-php
Files in rvalitov/backlink-checker-php
Package backlink-checker-php
Short 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.
License GPL-3.0-or-later
Homepage https://github.com/rvalitov/backlink-checker-php
Informations about the package backlink-checker-php
The Idea of Backlink Checker
It's a casual task to work with backlinks in SEO. There are several tools to check or search for backlinks. Unlike other tools, we do not scan all possible websites in Internet and do not analyze Google Search results in order to find backlinks to your website. We only validate a list of backlinks that you already know. You receive a list of backlinks using one of the following ways:
- you buy backlinks and receive the list of donor web pages
- you generate the backlinks yourself by posting on forums, 3rd party websites, etc.
- your SEO expert or company works for you and shows you the reports with backlinks as one of the SEO strategies
When you have such list of donor web pages,
you need to confirm that they actually contain the required backlink to your website.
Besides,
you need
to validate this list regularly in the future to monitor if the backlinks still exist and are not being deleted.
So, this package will help you to do that.
It allows checking for a fixed backlink,
such as https://example.com
and use search patterns,
such as *.example.com
and many others using regular expressions.
Browser Scraping Modes
Simple
Simple mode does not support JavaScript; it requires minimal dependencies, works fast, available on shared hosting. But it works only for simple or static HTML, for example, generated by Joomla, WordPress or Drupal. It will not find backlinks on websites that require JavaScript-enabled browser, for example, websites made with Laravel, Yii, React, etc.
Chromium (JavaScript enabled)
We use Chromium headless mode for JavaScript-enabled browsing. This approach allows parsing any website, and this is the recommended mode, but it uses more resources on the server and requires a little bit more time to configure the server.
How to Install
Step 1. Add the Package via Composer
You must have a Composer installed. Run the following command:
Here we use version 2.0.0 or later that support PHP 8.0 and latest versions of dependencies. If you want to use an earlier version, please check the 1.x.x releases.
Some dependencies from version 1.x.x are not supported anymore.
Therefore, I had to switch to community-driven forks.
As a result, such forks are not published in the composer library and have "dev" status.
To use them, you need to add the following two repositories to your composer.json
file,
so that composer knows where to look for them.
Besides, please add the following config (for example, before or after the "repositories" section) to allow composer to use "dev" versions of the packages:
After that run update:
Step 2. Install the Chromium
Note: You can skip this step if you don't need the Chromium mode.
You need to install the following packages first, to make the Chromium work.
For Debian/Ubuntu:
You must have a Node.Js installed. If it's not installed, install it using the official manual. Then run the following command to install the Chromium:
Step 3. Use Autoload
Include the autoload.php
in your source PHP file, for example:
How to Use
First, include the dependencies:
Then decide which mode to use, for Chromium mode use:
Or if you want a simple mode without JavaScript support use:
Make a scan of the desired URL with a desired pattern (use the PCRE pattern syntax):
The function getBacklinks
has the following additional options:
$scanBacklinks
- if set totrue
, then it scans for the backlinks (the text of thehref
attribute of<a>
tag); otherwise scanning is not performed.$scanHotlinks
- if set totrue
, then it scans for the hotlink (the text of thesrc
attribute of<img>
tag); otherwise scanning is not performed.$makeScreenshot
- if set totrue
, then we also take a screenshot of the viewport; otherwise screenshot is not made. This option makes sense only for Chromium mode (default viewport size is800 x 600
px, image format:JPEG
, image quality:90
, image encoding:binary
); for simple mode this option is ignored.
Now we should check the $result
, if the function succeeded:
The function $result->getBacklinks()
returns an array of objects that describe the backlink. Each object supports the following functions:
getBacklink
returnsstring
, a backlink - an exact URL that matches the target domain;getTag
returnsstring
, the tag that is used for the backlink, can bea
orimg
;getTarget
returnsstring
, contents oftarget
attribute of thehref
;getNoFollow
returnstrue
if the backlink hasnofollow
attribute;getAnchor
returnsstring
- anchor of the link, for example, inner text of<a>
tag. This text is returned in a plain text format, all HTML tags are stripped.
The $response
object supports the following functions:
getUrl
returnsstring
, the URL of that was analyzedgetStatusCode
returnsint
, the HTTP status code, or0
or-1
if there was a network error.getScreenshot
returnsstring
, the screenshot in binary format. If the screenshot was not taken or is not available, then the string is empty. If you want to display this screenshot as an image on a web page, then you should first save it to disk and use a link to it, or encode it into base64 and insert into the web page directly. In this case, you can use a function like:
Note. If you use function json_encode
on an object that contains the screenshot, then this screenshot will be converted to base64 format automatically.
Examples
Examples are available in a dedicated project on GitHub.
Tests are in tests
folder.
System Requirements
PHP 7.4+ required with the following extensions:
Feedback
Your feedback is very appreciated. If you want to see new features in this project, please post your ideas and feature requests in the issue tracker.
Support or Contact
Having trouble? Maybe something has already been reported in the issue tracker. If you don't find your problem there, then, please, add your issue there.
All versions of backlink-checker-php with dependencies
kub-at/php-simple-html-dom-parser Version ^1.9.1
guzzlehttp/guzzle Version 7.*
nesk/puphpeteer Version dev-zoon
ext-json Version *