northrook/inline-styles

Apply CSS-like selectors and merge declarations into HTML inline styles

Maintainers

Package info

codeberg.org/northrook/inline-styles

Issues

pkg:composer/northrook/inline-styles

Transparency log

Statistics

Installs: 3

Dependents: 0

Suggesters: 0

dev-main 2026-07-10 19:07 UTC

This package is not auto-updated.

Last update: 2026-07-11 16:48:57 UTC


README

[!WARNING] Early development.

The API and behaviour may change without notice.

Apply CSS-like selectors and merge declarations into HTML inline styles.

Requires PHP 8.4+.

Dependencies are ext-dom and ext-libxml.

Installation

composer require northrook/inline-styles

Quick start

use Northrook\InlineStyles;
use Northrook\InlineStyles\StripClasses;

$styles = new InlineStyles([
    '.btn' => 'color: red; padding: 4px',
    '#hero' => 'font-size: 24px',
], StripClasses::MATCHED);

$html = $styles
    ->rule('a[href^="https"]', 'text-decoration: none')
    ->apply($html);

Development

composer test
composer phpstan

License

BSD-3-Clause. See LICENSE.