Download the PHP package vormkracht10/laravel-seo-scanner without Composer

On this page you can find all versions of the php package vormkracht10/laravel-seo-scanner. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-seo-scanner

Laravel SEO Scanner

Total Downloads Tests PHPStan GitHub release (latest by date) Packagist PHP Version Support Latest Version on Packagist

Nice to meet you, we're Vormkracht10

Hi! We are a web development agency from Nijmegen in the Netherlands and we use Laravel for everything: advanced websites with a lot of bells and whitles and large web applications.

The Laravel tool to boost the SEO score of your web pages

Screenshot 2023-01-05 at 15 02 31

Introduction

This package is your guidance to get a better SEO score on search engines. Laravel SEO Scanner scans your code and crawls the routes from your app. The package has 24 checks that will check on performance, configurations, use of meta tags and content quality.

Easily configure which routes to scan, exclude or include specific checks or even add your own checks! Completing checks will further improve the SEO score and thus increase the chance of ranking higher at the search engines.

Minimum requirements

Installation

You can install the package via composer:

If you want to scan pages that are rendered using Javascript, for example Vue or React, you need to install Puppeteer. You can install it using the following command:

If you want to know how to scan Javascript rendered pages, check out Puppeteer documentation.

Run the install command to publish the config file and run the migrations:

Or you can publish the config file and run the migrations manually:

Click here to see the config file.

Available checks

These checks are available in the package. You can add or remove checks in the config file. These checks are based on SEO best practices and if all checks are green, your website will have a good SEO score. If you want to add more checks, you can create a pull request.

Configuration

✅ The page does not have 'noindex' set.
✅ The page does not have 'nofollow' set.
✅ Robots.txt allows indexing.

Content

✅ The page has an H1 tag and if it is used only once per page.
✅ All links redirect to an url using HTTPS.
✅ Every image has an alt attribute.
✅ The page contains no broken links.
✅ The page contains no broken images.
✅ Length of the content is at least 2100 characters.
✅ No more than 20% of the content contains too long sentences (more than 20 words).
✅ A minimum of 30% of the sentences contain a transition word or phrase.

Note: To change the locale of the transition words, you can publish the config file and change the locale in the config file. The default locale is null which uses the language of your app config. If set to nl or en, the transition words will be in Dutch or English. If you want to add more locales, you can create a pull request.

Meta

✅ The page has a meta description.
✅ The page title is not longer than 60 characters.
✅ The page has an Open Graph image.
✅ The lang attribute is set on the html tag.
✅ The title contains one or more keywords.
✅ One or more keywords are present in the first paragraph.

Performance

✅ Time To First Byte (TTFB) is below 600ms.
✅ The page response returns a 200 status code.
✅ HTML is not larger than 100 KB.
✅ Images are not larger than 1 MB.
✅ JavaScript files are not larger than 1 MB.
✅ CSS files are not larger than 15 KB.
✅ HTML is GZIP compressed.

Usage

Running the scanner in a local environment

If you are using auto signed SSL certificates in your local development environment, you may want to disable the SSL certificate integrity check. You can do this by adding the following option to the http.options array in the config file:

It's also possible to pass custom headers to the http client. For example, if you want to set a custom user agent, you can add the following option to the http.headers array in the config file:

Scanning routes

By default, all GET routes will be checked for SEO. If you want to check the SEO score of a specific route, you can add the route name to the routes array in the config file. If you want to skip a route, you can add the route name to the exclude_routes array in the config file. If you don't want to check the SEO score of routes at all, you can set the check_routes option to false in the config file.

To check the SEO score of your routes, run the following command:

If you want to queue the scan and trigger it manually you can dispatch the 'Scan' job:

Scanning a single route

Want to get the score of a specific url? Run the following command:

Note: The command will only check the SEO score of the url and output the score in the CLI. It will not save the score to the database.

Scanning routes in an SPA application

If you have an SPA application, you can enable javascript rendering. This will use a headless browser to render the content. To enable javascript rendering, set the javascript option to true in the config file. You can also enable javascript rendering for a single route by adding the --javascript option to the command:

Note: This command will use Puppeteer to render the page. Make sure that you have Puppeteer installed on your system. You can install Puppeteer by running the following command: npm install puppeteer. At this moment it's only available when scanning single routes.

Throttling

If you want to throttle the requests, you can set the throttle option to true in the config file. You can also set the amount of requests per minute by setting the requests_per_minute option in the config file.

Scan model urls

When you have an application where you have a lot of pages which are related to a model, you can save the SEO score to the model. This way you can check the SEO score of a specific page and show it in your application.

For example, you have a BlogPost model which has a page for each content item:

  1. Add the model to the models array in the config file.
  2. Implement the SeoInterface in your model.
  3. Add the HasSeoScore trait to your model.

Note: Please make sure that the model has a url attribute. This attribute will be used to check the SEO score of the model. Also check that the migrations are run. Otherwise the command will fail.

You can get the SEO score of a model by calling the seoScore() or seoScoreDetails() methods on the model. These methods are defined in the HasSeoScore trait and can be overridden by adding the modified method in your model.

To fill the database with the scores of all models, run the following command:

To get the SEO score(s) of a model, you have the following options:

  1. Get the SEO scores of a single model from the database:

  2. Run a SEO score check on a single model:

Saving scans into the database

When you want to save the SEO score to the database, you need to set the save option to true in the config file.

Optionally you can specify the database connection in the config file. If you want to save the SEO score to a model, you need to add the model to the models array in the config file. More information about this can be found in the Check the SEO score of a model section.

Pruning the database

Per default the package will prune the database from old scans. You can specify the number of days you want to keep the scans in the database. The default is 30 days.

If you want to prune the database, you need to add the prune command to your App\Console\Kernel:

Please refer to the Laravel documentation for more information about pruning the database.

Listening to events

When you run the seo:scan command, the package will fire an event to let you know it's finished. You can listen to this events and do something with the data. For example, you can send an email to the administrator when the SEO score of a page is below a certain threshold. Add the following code to your EventServiceProvider:

Retrieving scans

You can retrieve the scans from the database by using the SeoScan model. This model is used to save the scans to the database. You can use the SeoScan model to retrieve the scans from the database. For example:

Retrieving scores

You can retrieve the scores from the database by using the SeoScore model. This model is used to save the scores to the database. You can use the SeoScore model to retrieve the scores from the database. For example:

Adding your own checks

You can add your own checks to the package. To do this, you need to create a check class in your application.

  1. Create a new class in your application which implements the Vormkracht10\Seo\Interfaces\Check interface.
  2. Add the Vormkracht10\Seo\Traits\PerformCheck trait to your class.
  3. Add the base path of your check classes to the check_paths array in the config file.

Example

In this example I make use of the symfony/dom-crawler package to crawl the HTML of a page as this is far more reliable than using preg_match for example. Feel free to use anything you want. The crawler is always passed to the check method, so you still need to define the $crawler parameter in your check method.

The config file:

Testing

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-seo-scanner with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
guzzlehttp/guzzle Version ^7.5
illuminate/contracts Version ^9.0|^10.0|^11.0
j0k3r/php-readability Version ^2.0
jeremykendall/php-domain-parser Version ^6.3
spatie/browsershot Version ^3.0|^4.0|^5.0
spatie/laravel-package-tools Version ^1.13
symfony/dom-crawler Version ^6.2|^7.0
symfony/finder Version ^6.2|^7.0
vipnytt/robotstxtparser Version ^2.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package vormkracht10/laravel-seo-scanner contains the following files

Loading the files please wait ....