flying-anvil/badge-generator
Composer 安装命令:
composer require flying-anvil/badge-generator
包简介
It generates badges as .svg
README 文档
README
Tool for generating badges, like
How To
Executable Script
Run the generate.php script to generate a badge.
It accespts some parameters to customize the result:
| short | long | description | default |
|---|---|---|---|
| o | output | file to write to | stdout |
| l | left | specifies the left text | |
| r | right | specifies the right text | |
| g | no-gradient | no value, removes the gradient in the badge | omitted |
| p | no-percentage-coloring | no value, disables auto-coloring based on the right text | omitted |
| radius | radius of the edges | 5.0 | |
| left-text-color | color of the left text | eeeeee | |
| right-text-color | color of the right text | eeeeee | |
| left-background-color | background color of the left segment | 555555 | |
| right-background-color | background color of the right segment | 4B3D6C | |
| low-percent-color | right background color for 0% when using auto coloring | B31329 | |
| mid-percent-color | right background color for 50% when using auto coloring | CDAB58 | |
| hight-percent-color | right background color for 100% when using auto coloring | 2AC258 |
Using Generator
Create a Generator and feed it with some options:
<?php
require_once __DIR__ . '/../vendor/autoload.php';
$badgeOptions = \FlyingAnvil\BadgeGenerator\Application\DataObject\BadgeOptions::create('left', 'right');
$badgeOptions->setLeftText('direction');
$badgeOptions->setRadius(3);
$badgeOptions->setLeftBackgroundColor(\FlyingAnvil\BadgeGenerator\Application\DataObject\Color::createFromHex('00cc00'));
$badgeGenerator = new \FlyingAnvil\BadgeGenerator\Application\Service\Generator();
$badge = $badgeGenerator->generate($badgeOptions);
echo $badge;
统计信息
- 总下载量: 103
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-07-25