Download the PHP package juampi92/test-seo without Composer

On this page you can find all versions of the php package juampi92/test-seo. 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 test-seo

Test SEO

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

An easy-to-use package for testing SEO. The package allows you to extract SEO tags from a given HTML and verify that the SEO structure is correct.


Installation

You can install the package via composer:

Usage

Look at the following examples using PHPUnit, Laravel, and Pest.

PHPUnit

Laravel

Pest

SEO Data

You can access the SEO Data yourself by accessing the public property TestSEO->data. Here are the available methods:

Method Returns Description
title() ?string <title>{this}</title>
description() ?string <meta name="description" content="{this}">
image() ?Url 🔍 <meta name="image" content="{this}">
robots() Robots 🔍 <meta name="robots" content="{this}">
canonical() ?Url 🔍 <link rel="canonical" href="{this}">
prev() ?Url 🔍 <link rel="prev" href="{this}">
next() ?Url 🔍 <link rel="next" href="{this}">
openGraph() TagCollection 🔍 <meta property="og:{key}" content="{value}">
twitter() TagCollection 🔍 <meta name="twitter:{key}" content="{value}">
alternateHrefLang() AlternateHrefLangCollection 🔍 <link name="alternate" hreflang="{hreflang}" href={href}>
images() array<array{src: string, alt: string, title: string}> All images in the page. <img src="...">
h1s() array<string> All H1 in the page. <h1>{this}</h1>
h2s() array<string> All H2 in the page. <h2>{this}</h2>
charset() ?string <meta charset="utf-8">

The SEOData class is Macroable, so feel free to extend it yourself.

Assertions

Method Notes
assertCanonicalIs(string $expected)
assertCanonicalIsEmpty()
assertRobotsIsEmpty()
assertRobotsIsNoIndexNoFollow() Checks that the robots are noindex, nofollo or none
assertPaginationIsEmpty() prev and next are both missing.
assertAlternateHrefLangIsEmpty()
assertTitleIs(string $expected)
assertTitleContains(string $expected)
assertTitleEndsWith(string $expected)
assertDescriptionIs(string $expected)
assertThereIsOnlyOneH1() Make sure there is only one H1 in the entire website.
assertAllImagesHaveAltText() Make sure all images have an alt="..."
Suggest your own! These assertions can help devs to follow the best SEO practices. Make a PR if you think some are missing!

Snapshots

When it comes to SEO, a snapshot test is a great way to ensure nothing has been changed by accident.

Here is an example:

By default, the SEO tags are serialized using the SimpleSerializer. Make your own serializer by implementing the SnapshotSerializer interface:

Pest Example

Note: this example requires spatie/pest-plugin-snapshots.

Contributing

Please see CONTRIBUTING for details.

Credits

License

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


All versions of test-seo with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0.2
illuminate/macroable Version ^7.0|^8.0|^9.0|^10.0
phpunit/phpunit Version ^8.3|^9.0|^10.0
spatie/url Version ^1.3.4|^2.0
symfony/dom-crawler Version ^5.4|^6.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 juampi92/test-seo contains the following files

Loading the files please wait ....