ui-awesome/html-svg

UI Awesome HTML SVG library for PHP.

Fund package maintenance!
terabytesoftw

Installs: 8 633

Dependents: 7

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/ui-awesome/html-svg

0.2.0 2024-03-31 13:02 UTC

README

UI Awesome

Html SVG


PHPUnit Mutation Testing PHPStan

A robust, fluent, and immutable PHP library for generating and manipulating SVG elements.
Secure file loading, accessibility-first design, and standards-compliant rendering.

Features

Feature Overview

Installation

composer require ui-awesome/html-svg:^0.3

Quick start

The SVG element is a container that defines a new coordinate system and viewport.

It is used as the outermost element of SVG documents, but it can also be used to embed an SVG fragment inside an SVG or HTML document.

Basic usage

use UIAwesome\Html\Svg\Svg;

// create a simple SVG with path
echo Svg::tag()
    ->content('<path d="..." />')
    ->viewBox('0 0 100 100')
    ->render();

Loading from file (Secure)

use UIAwesome\Html\Svg\Svg;

// load, sanitize, and inject an external SVG file
echo Svg::tag()
    ->class('icon-lg')
    ->filePath('/path/to/icon.svg')
    ->fill('currentColor')
    ->render();

Accessibility handling

use UIAwesome\Html\Svg\Svg;

// automatically injects <title> tag for screen readers
echo Svg::tag()
    ->content('<path d="..." />')
    // Becomes <title>User Profile</title>
    ->title('User Profile')
    ->render();

Documentation

For detailed configuration options and advanced usage.

Package information

PHP Latest Stable Version Total Downloads

Quality code

Codecov PHPStan Level Max Super-Linter StyleCI

Our social networks

Follow on X

License

License