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: 11

Dependents: 2

Suggesters: 0

dev-main 2026-08-07 12:37 UTC

This package is not auto-updated.

Last update: 2026-08-08 17:06:30 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.5+.

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 check
composer fmt

License

BSD-3-Clause. See LICENSE.