PHPackages                             lightship-core/lightship-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. lightship-core/lightship-php

ActiveLibrary

lightship-core/lightship-php
============================

Web page performance/seo/security/accessibility analysis, browser-less.

0.9.0(3y ago)8121[1 issues](https://github.com/lightship-core/lightship-php/issues)1MITPHPPHP &gt;=8.1.0

Since Apr 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/lightship-core/lightship-php)[ Packagist](https://packagist.org/packages/lightship-core/lightship-php)[ RSS](/packages/lightship-core-lightship-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (7)Versions (17)Used By (1)

Lightship
=========

[](#lightship)

Web page performance/seo/security/accessibility analysis, browser-less.

```
[
  {
    "url": "https:\/\/example.com\/",
    "durationInSeconds": 0.15,
    "scores": {
      "seo": 100,
      "security": 75
    },
    "seo": [
      {
        "name": "titlePresent",
        "passes": true
      },
      {
        "name": "langPresent",
        "passes": true
      }
    ],
    "security": [
      {
        "name": "xFrameOptionsPresent",
        "passes": true
      },
      {
        "name": "strictTransportSecurityHeaderPresent",
        "passes": true
      },
      {
        "name": "serverHeaderHidden",
        "passes": false
      },
      {
        "name": "xPoweredByHidden",
        "passes": true
      }
    ]
  }
]
```

Summary
-------

[](#summary)

- [About](#about)
- [Examples](#examples)
- [Compatibility table](#compatibility-table)
- [Tests](#tests)

About
-----

[](#about)

I made a web app, and I want to be able to frequently test my public facing pages respond to various criterias to optimize their referencing.

Since my web app is fully server-side, all my tests are very fast, and do not rely on a web browser. I wanted to stick to this, and have a fast tool to get simple insights, like not ommiting the alt attributes on images, to ensure my description and title are filled, or to evaluate aproximatively my page load time.

Examples
--------

[](#examples)

- [1. Simple example code-driver](#1-simple-example-code-driven)
- [2. Simple example using a configuration file](#2-simple-example-using-a-configuration-file)
- [3. Set a response callback](#3-set-a-response-callback)
- [4. Assert rule passed for URLs](#4-assert-rule-passed-for-urls)

### 1. Simple example code-driven

[](#1-simple-example-code-driven)

In this example, we will configure our web pages using the code.

```
require __DIR__ . "/vendor/autoload.php";

use Lightship\Lightship;

$lightship = new Lightship();

$lightship->domain("https://news.google.com")
  ->route("/foryou")
  ->route("/topstories")
  ->route("/my/searches", ["hl" => "fr", "gl" => "FR"]);
  ->analyse();

file_put_contents("report.json", $lightship->toPrettyJson());
```

### 2. Simple example using a configuration file

[](#2-simple-example-using-a-configuration-file)

In this example, we will tell Lightship to use our "lightship.json" file instead of configuring it on the code.

```
require __DIR__ . "/vendor/autoload.php";

use Lightship\Lightship;

$lightship = new Lightship();

$lightship->config(__DIR__ . "/lightship.json");
  ->analyse();

file_put_contents("report.json", $lightship->toPrettyJson());
```

And here is our configuration file.

```
{
  "domains": [
    {
      "base": "https://news.google.com",
      "routes": [
        {
          "path": "/foryou"
        },
        {
          "path": "/topstories"
        },
        {
          "path": "/my/searches",
          "queries": [
            {
              "key": "hl",
              "value": "fr"
            },
            {
              "key": "gl",
              "value": "FR"
            }
          ]
        }
      ]
    }
  ]
}
```

### 3. Set a response callback

[](#3-set-a-response-callback)

In this example, we will trigger our function after a response has been parsed and a report generated. Useful for cli programs.

```
use Lightship\Lightship;

require __DIR__ . "/vendor/autoload.php";

$lightship = new Lightship();

$lightship->route("https://example.com")
  ->route("https://northerwind.com")
  ->onReportedRoute(function (Route $route, Report $report): void {
    echo "{$route->path()}: {$report->score(RuleType::Security)}" . PHP_EOL;

    foreach ($report->results as $result) {
      echo "  {$result->name} {$result->passes}";
    }
  })
  ->analyse();
```

This will display something like this:

```
https://example.com/: 38
https://northerwind.com/: 61
```

### 4. Assert rule passed for URLs

[](#4-assert-rule-passed-for-urls)

Useful in your tests and CI, you can assert your URLs pass some/all rules.

```
use Lightship\Lightship;
use Lightship\Rules\Seo\LangPresent;
use Lightship\Rules\Performance\FastResponseTime;

$lightship = new Lightship();

$lightship->route("https://example.com")
  ->route("https://google.com")
  ->analyse();

assert($lightship->rulePassed(["https://example.com"], LangPresent::class) === true);

assert($lightship->allRulesPassed(["https://google.com"]) === true);

assert($lightship->someRulesPassed(["https://google.com"], [LangPresent::class, FastResponseTime::class]) === true);
```

Requirements
------------

[](#requirements)

- [PHP](https://www.php.net/)
- [Composer](https://getcomposer.org/)

Installation
------------

[](#installation)

```
composer require lightship-core/lightship-php
```

Compatibility table
-------------------

[](#compatibility-table)

This table shows the compatibility with PHP versions **for this current package version** only.

PHP versionSupported8.2.\*✅8.1.\*✅&lt; 8.1.\*❌Tests
-----

[](#tests)

```
composer run analyse
composer run test
composer run lint
composer run check
composer run scan
composer run updates
```

Or

```
composer run all
```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~28 days

Recently: every ~55 days

Total

9

Last Release

1253d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15908747?v=4)[Anwar](/maintainers/khalyomede)[@khalyomede](https://github.com/khalyomede)

---

Top Contributors

[![khalyomede](https://avatars.githubusercontent.com/u/15908747?v=4)](https://github.com/khalyomede "khalyomede (81 commits)")[![aminnairi](https://avatars.githubusercontent.com/u/18418459?v=4)](https://github.com/aminnairi "aminnairi (1 commits)")

---

Tags

auditbrowserlesslighthousephpweb

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/lightship-core-lightship-php/health.svg)

```
[![Health](https://phpackages.com/badges/lightship-core-lightship-php/health.svg)](https://phpackages.com/packages/lightship-core-lightship-php)
```

###  Alternatives

[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.4k5.6M651](/packages/sylius-sylius)[neuron-core/neuron-ai

The PHP Agentic Framework.

1.8k245.3k21](/packages/neuron-core-neuron-ai)[tencentcloud/tencentcloud-sdk-php

TencentCloudApi php sdk

3731.2M42](/packages/tencentcloud-tencentcloud-sdk-php)[php-soap/wsdl-reader

A WSDL reader in PHP

212.3M9](/packages/php-soap-wsdl-reader)[sylius/core

Sylius e-commerce core. It integrates all components.

10143.1k31](/packages/sylius-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
