Skip to content

SRWieZ/php-svg-ps-converter

Repository files navigation

SVGTinyPS

Latest Stable Version Total Downloads Latest Unstable Version License PHP Version Require GitHub Workflow Status (with event)

SVG (Portable and Secure) converter for BIMI compliance.

Read more from bimi group and the RFC

🧪 If you just want to convert your SVG in a nice ui, you can use the online version of the converter!

You can also checkout the command line version of this project.

Installation

composer require srwiez/php-svg-ps-converter

Usage

Example of identifying issues and converting the SVG:

$svg_converter = new SVGTinyPS(getSVGContent($svg_content));
$issues = $svg_converter->identifyIssues();
$svg_fixed= $svg_converter->convert();

Some issues cannot be fixed automatically, you can get them by rerunning identifyIssues()

Namely, the issues that cannot be fixed are:

  • The SVG contains an image
  • The SVG is not square
  • The SVG size > 32kb
$svg_converter = new SVGTinyPS(getSVGContent($svg_fixed));
$issues_cannot_be_fixed = $svg_converter->identifyIssues();

Credits

SVGTinyPS was created by Eser DENIZ.

Inspired by the official scripts of authindicators/svg-ps-converters

Thanks to gilbarbara/logos for the logos used in the tests.

License

SVGTinyPS PHP is licensed under the MIT License. See LICENSE for more information.