projector22/php-svg-tool
最新稳定版本:1.0.0
Composer 安装命令:
composer require projector22/php-svg-tool
包简介
A tool for handling SVG files with PHP
README 文档
README
A simple PHP tool to perform basic functions on SVG files.
At Present
This tool takes the input of an <svg></svg> markup, either from a .svg file or just typed in. It then allows you to set or change custom attributes on the <svg></svg> as desired.
Currently only the <svg> tag can be manipulated, as the inner markup is beyond the current need.
Build
This tool was built on PHP 8.1 - backwards compatibility to PHP 8.0 should be fine, but this tool should be incompatable with PHP 7.x and below as it uses a number of features introduced in PHP 8.0.
Example
<?php $svg = new SVG( file_get_contents( 'path/to/file.svg' ) ); $svg->set_id( 'myId' ) ->set_size( 150, 150 ) ->add_to_classlist( 'myClass' ) ->set_stroke( 'red' ) ->echo(); echo $svg->return();
The above code will render the SVG image twice.
统计信息
- 总下载量: 112
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: mit
- 更新时间: 2022-06-10