PHPackages                             olegatro/html-sanitizer-relative - 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. [Validation &amp; Sanitization](/categories/validation)
4. /
5. olegatro/html-sanitizer-relative

ActiveLibrary[Validation &amp; Sanitization](/categories/validation)

olegatro/html-sanitizer-relative
================================

Extension for html-sanitizer library by allowing relative urls in the A and Image tags

1.0.0(5y ago)0755MITPHPPHP &gt;=7.1

Since Feb 5Pushed 5y ago1 watchersCompare

[ Source](https://github.com/olegatro/html-sanitizer-relative)[ Packagist](https://packagist.org/packages/olegatro/html-sanitizer-relative)[ RSS](/packages/olegatro-html-sanitizer-relative/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

html-sanitizer-relative
=======================

[](#html-sanitizer-relative)

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

[](#installation)

`composer require olegatro/html-sanitizer-relative`

### Example

[](#example)

```
require_once __DIR__ . '/vendor/autoload.php';

use HtmlSanitizer\Extension\Basic\BasicExtension;
use HtmlSanitizer\SanitizerBuilder;

$builder = new SanitizerBuilder();
$builder->registerExtension(new BasicExtension());

//relative-a and relative-image
$builder->registerExtension(new \HtmlSanitizer\Extension\Relative\A\AExtension());
$builder->registerExtension(new \HtmlSanitizer\Extension\Relative\Image\ImageExtension());

$config = [
    'extensions' => ['basic', 'relative-a', 'relative-image'],
    'tags'       => [
        'div' => [
            'allowed_attributes' => ['class', 'title']
        ],
        'img' => [
            'allowed_attributes' => ['src', 'alt', 'title', 'class']
        ]
    ]
];

$sanitizer = $builder->build($config);

//Examples

$rawHtml = 'github.com';
$rawHtml .= 'github.com';
$safeHtml = $sanitizer->sanitize($rawHtml);

//github.com
//github.com

$rawHtml = '';
$rawHtml .= '';
$safeHtml = $sanitizer->sanitize($rawHtml);

//
//
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Unknown

Total

1

Last Release

1922d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/204db5f1b9e695526adb46f617a5be527280c08b9718d6964b70c0c2d24c31b9?d=identicon)[olegatro](/maintainers/olegatro)

---

Top Contributors

[![olegatro](https://avatars.githubusercontent.com/u/4980366?v=4)](https://github.com/olegatro "olegatro (3 commits)")

---

Tags

php

### Embed Badge

![Health badge](/badges/olegatro-html-sanitizer-relative/health.svg)

```
[![Health](https://phpackages.com/badges/olegatro-html-sanitizer-relative/health.svg)](https://phpackages.com/packages/olegatro-html-sanitizer-relative)
```

###  Alternatives

[webmozart/assert

Assertions to validate method input/output with nice error messages.

7.6k894.0M1.2k](/packages/webmozart-assert)[bensampo/laravel-enum

Simple, extensible and powerful enumeration implementation for Laravel.

2.0k15.9M104](/packages/bensampo-laravel-enum)[swaggest/json-schema

High definition PHP structures with JSON-schema based validation

48612.5M73](/packages/swaggest-json-schema)[stevebauman/purify

An HTML Purifier / Sanitizer for Laravel

5325.6M19](/packages/stevebauman-purify)[ashallendesign/laravel-config-validator

A package for validating your Laravel app's config.

217905.3k5](/packages/ashallendesign-laravel-config-validator)[crazybooot/base64-validation

Laravel validators for base64 encoded files

1341.9M8](/packages/crazybooot-base64-validation)

PHPackages © 2026

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