Skip to content

A PHP library to build badges as seen in README's of many open source libraries.

License

Notifications You must be signed in to change notification settings

phpbadge/phpbadge

Repository files navigation

phpbadge

Build Status Scrutinizer Code Quality Code Coverage Dependency Status SensioLabsInsight

A PHP library to build badges as seen in README's of many open source libraries.

Getting started

It's recommended to install this library via Composer.

composer require phpbadge/phpbadge

The current master branch is considered stable. The badges on top of this document should confirm this.

Requirements

As from version 2.0.0 this library needs a PHP version >= 7.1.

Older version of the library run on PHP 5.3, PHP 5.4, PHP 5.5, PHP 5.6, PHP 7 and HHVM.

Example

<?php

use PHP\Badge\Badge;
use PHP\Badge\Font\Font;
use PHP\Badge\Font\GdDimensionCalculator;
use PHP\Badge\Part;
use PHP\Badge\Renderer\SvgRenderer;

require 'vendor/autoload.php';

$badge = new Badge();
$badge->setBorderRadius(3);
$badge->addPart(new Part('build', '#555', '#fff', new Font(11, 'verdana', 'fonts/verdana.ttf')));
$badge->addPart(new Part('passing', '#4c1', '#fff', new Font(11, 'verdana', 'fonts/verdana.ttf')));

$renderer = new SvgRenderer(new GdDimensionCalculator());

echo $renderer->render($badge);

About

A PHP library to build badges as seen in README's of many open source libraries.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages