PHPackages                             badges/poser - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. badges/poser

ActiveLib[Utility &amp; Helpers](/categories/utility)

badges/poser
============

Poser, add badges on your readme..

v3.4.1(1mo ago)14678.3k—3.8%44[9 issues](https://github.com/badges/poser/issues)[2 PRs](https://github.com/badges/poser/pulls)8MITPHPPHP ^8.1CI passing

Since Aug 24Pushed 1mo ago9 watchersCompare

[ Source](https://github.com/badges/poser)[ Packagist](https://packagist.org/packages/badges/poser)[ Docs](https://github.com/PUGX)[ Fund](https://paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ETT4JRJARLTSC)[ GitHub Sponsors](https://github.com/AlessandroMinoccheri)[ RSS](/packages/badges-poser/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (21)Versions (32)Used By (8)

PHP badges poser [![GitHub actions](https://github.com/badges/poser/workflows/Build/badge.svg)](https://github.com/badges/poser/actions)
========================================================================================================================================

[](#php-badges-poser-)

This is a php library that creates badges like [![Badge Poser](https://camo.githubusercontent.com/405742e27baa61741c7ef073276797dc025630412c66feff5e721f0156b2d4cb/68747470733a2f2f63646e2e7261776769742e636f6d2f6261646765732f706f7365722f6d61737465722f62616467652d706f7365722e737667)](https://camo.githubusercontent.com/405742e27baa61741c7ef073276797dc025630412c66feff5e721f0156b2d4cb/68747470733a2f2f63646e2e7261776769742e636f6d2f6261646765732f706f7365722f6d61737465722f62616467652d706f7365722e737667) and [![I'm a badge](https://camo.githubusercontent.com/045c7d27de78a91f7cfba8cf379b3912cade5a8ac13782ce05e3e74941be91d3/68747470733a2f2f63646e2e7261776769742e636f6d2f6261646765732f706f7365722f6d61737465722f695f6d2d62616467652e737667)](https://camo.githubusercontent.com/045c7d27de78a91f7cfba8cf379b3912cade5a8ac13782ce05e3e74941be91d3/68747470733a2f2f63646e2e7261776769742e636f6d2f6261646765732f706f7365722f6d61737465722f695f6d2d62616467652e737667) and [![dark](https://camo.githubusercontent.com/5d11c97e2f7b52a889a4111249bc3effdd48e29916dd574bfcbcd3cdec11aa20/68747470733a2f2f63646e2e7261776769742e636f6d2f6261646765732f706f7365722f6d61737465722f746f6461792d6461726b2e737667)](https://camo.githubusercontent.com/5d11c97e2f7b52a889a4111249bc3effdd48e29916dd574bfcbcd3cdec11aa20/68747470733a2f2f63646e2e7261776769742e636f6d2f6261646765732f706f7365722f6d61737465722f746f6461792d6461726b2e737667), according to [Shields specification](https://github.com/badges/shields#specification).

This library is used by

[![Latest Stable Version](https://camo.githubusercontent.com/d84e2d66d1ec0bc099b362429d74a976ff11151fe4acedf3e78e3df1db41fb9d/68747470733a2f2f706f7365722e707567782e6f72672f6261646765732f706f7365722f76657273696f6e2e737667)](https://packagist.org/packages/badges/poser) [![Latest Unstable Version](https://camo.githubusercontent.com/a209786136f8565ea1e2dcab7165cd82d85c18a52eb888e4a3a543fc48f1dbc1/68747470733a2f2f706f7365722e707567782e6f72672f6261646765732f706f7365722f762f756e737461626c652e737667)](//packagist.org/packages/badges/poser) [![Total Downloads](https://camo.githubusercontent.com/7e9c0a306c8320a2eaa79d8557858cac409583d199003ae2ec581864d4d25ced/68747470733a2f2f706f7365722e707567782e6f72672f6261646765732f706f7365722f646f776e6c6f6164732e737667)](https://packagist.org/packages/badges/poser)[![Github actions Build](https://github.com/badges/poser/workflows/Build/badge.svg)](//packagist.org/packages/badges/poser)[![PHP Version Require](https://camo.githubusercontent.com/916d0b93f1fd2dd3db65394e075ae19fa1c8cd878e7d18d28259fd15161dc266/687474703a2f2f706f7365722e707567782e6f72672f6261646765732f706f7365722f726571756972652f706870)](https://packagist.org/packages/badges/poser)

Dependencies
------------

[](#dependencies)

- PHP 8.1 or higher
- GD extension

you can still use the library with lower PHP versions, using the old releases

Use as command
--------------

[](#use-as-command)

#### 1. Create a project

[](#1-create-a-project)

```
composer create-project badges/poser
ln -s poser/bin/poser /usr/local/bin/poser
```

#### 2. Launch the command

[](#2-launch-the-command)

Create an image

```
poser license MIT blue -p "license.svg"
```

Flush an image

```
poser license MIT blue
```

Choose a different style

```
poser license MIT blue -s "for-the-badge"
```

The available styles are `plastic`, `flat`, `flat-square`, `for-the-badge`, and `social`.

You can also use the provided Docker Compose services:

```
docker compose run --rm php82 bin/poser license MIT blue
docker compose run --rm php83 bin/poser license MIT blue -p "license.svg"
docker compose run --rm php83 bin/poser license MIT blue -s "plastic" -p "license-plastic.svg"
```

Usage as library
----------------

[](#usage-as-library)

#### 1. Add to composer dependencies

[](#1-add-to-composer-dependencies)

```
composer require badges/poser
```

#### 2. Use in your project as lib

[](#2-use-in-your-project-as-lib)

```
use PUGX\Poser\Render\SvgPlasticRender;
use PUGX\Poser\Poser;

$render = new SvgPlasticRender();
$poser = new Poser([$render]);

echo $poser->generate('license', 'MIT', '428F7E', 'plastic');
// or
echo $poser->generateFromURI('license-MIT-428F7E.svg?style=plastic');
// or
echo $poser->generateFromURI('license-MIT-428F7E?style=plastic');
// or
$image = $poser->generate('license', 'MIT', '428F7E', 'plastic');

echo $image->getStyle();
```

The allowed styles are: `plastic`, `flat`, `flat-square`, `for-the-badge`, and `social`.

Badge customization
-------------------

[](#badge-customization)

Badges generated from a URI support these query string options:

OptionDescription`style`Badge style: `plastic`, `flat`, `flat-square`, `for-the-badge`, or `social`.`labelColor`Color for the left side of the badge. Accepts named colors, 6-digit hex, or 3-digit hex.`logo`Optional logo as an image URL, `data:image/...` URI, or SVG path data.`logoColor`Color used when `logo` is SVG path data. Defaults to white. Accepts named colors, 6-digit hex, or 3-digit hex.Examples:

```
echo $poser->generateFromURI('license-MIT-blue.svg?style=social');
echo $poser->generateFromURI('build-passing-brightgreen.svg?labelColor=555');
echo $poser->generateFromURI('github-stars-333.svg?style=social&logo=https%3A%2F%2Fexample.com%2Fgithub.svg');

$logo = rawurlencode('M12 2L2 22h20L12 2z');
echo $poser->generateFromURI('php-8.4-777.svg?logoColor=blueviolet&logo=' . $logo);
```

When these options are used in a URL, encode reserved characters. In particular, encode `#` as `%23`, and encode full image/data URLs passed as `logo`.

The CLI currently exposes style selection with `--style`; `labelColor`, `logo`, and `logoColor` are available through URI-based generation.

Custom SVG templates
--------------------

[](#custom-svg-templates)

Since `v3.4.0`, SVG templates use `vendorStartX` and `valueStartX` instead of the old `vendorStartPosition` and `valueStartPosition` placeholders. If you maintain custom templates, update them before upgrading:

```
- {{ vendorStartPosition }}
- {{ valueStartPosition }}
+ {{ vendorStartX }}
+ {{ valueStartX }}
```

These values are the text center positions multiplied by 10 and are intended to be used with `transform="scale(.1)"`, as the bundled templates do.

The renderer also provides these optional template placeholders: `vendorUpper`, `valueUpper`, `vendorTextLength`, `valueTextLength`, `vendorWidthMinus1`, `valueWidthMinus1`, `valueRectX`, `separatorX`, and `logoElement`.

### Examples (generated with `make doc-images`)

[](#examples-generated-with-make-doc-images)

[![Flat style](doc/flat.svg)](doc/flat.svg)

[![Flat square style](doc/flat-square.svg)](doc/flat-square.svg)

[![Plastic style](doc/plastic.svg)](doc/plastic.svg)

[![For the badge style](doc/for-the-badge.svg)](doc/for-the-badge.svg)

Encoding
--------

[](#encoding)

Dashes `--` → `-` Dash

Underscores `__` → `_` Underscore

`_` or Space → Space

More
----

[](#more)

For *more info* please see the [behat features](./features/)and the examples in the [php-spec folder](./spec/)

Why a composer badge?
---------------------

[](#why-a-composer-badge)

Not only because all the other languages already have it, but having the latest stable release in the readme could save time.

Contributing
------------

[](#contributing)

Active contribution and patches are very welcome.
Please refer to [CONTRIBUTING](CONTRIBUTING.md)

Docker development
------------------

[](#docker-development)

You can use the env var CONTAINER to run the tests in a specific PHP version. The default version if CONTAINER is omitted is php83.

#### 1. Setup your Docker environment

[](#1-setup-your-docker-environment)

```
CONTAINER=php83 make setup
```

#### 2. Run the tests

[](#2-run-the-tests)

```
CONTAINER=php83 make tests
```

#### 3. Run the tests for all PHP versions

[](#3-run-the-tests-for-all-php-versions)

```
make matrix-tests
```

License
-------

[](#license)

[![License](https://camo.githubusercontent.com/835094a17e408cac6b41a407f30ed2932d5ba86e116bf431593f2bf9e479af78/68747470733a2f2f706f7365722e707567782e6f72672f6261646765732f706f7365722f6c6963656e73652e737667)](./LICENSE)

###  Health Score

68

—

FairBetter than 99% of packages

Maintenance92

Actively maintained with recent releases

Popularity48

Moderate usage in the ecosystem

Community36

Small or concentrated contributor base

Maturity83

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~179 days

Recently: every ~106 days

Total

25

Last Release

37d ago

Major Versions

v1.4.1 → v2.0.02020-07-29

v2.3.1 → v3.0.02023-12-11

PHP version history (3 changes)1.2.1PHP &gt;=5.3

v2.0.0PHP &gt;=7.4

v3.0.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/446a646f719434553ab25f0f931d28ec09fbb036528126ac7e9d54a2e8132581?d=identicon)[liuggio](/maintainers/liuggio)

![](https://www.gravatar.com/avatar/8dab7be39a6adf2b47f924eed2d1cc45b1e37e292557f4395961a00651d3bff5?d=identicon)[JellyBellyDev](/maintainers/JellyBellyDev)

---

Top Contributors

[![JellyBellyDev](https://avatars.githubusercontent.com/u/190820?v=4)](https://github.com/JellyBellyDev "JellyBellyDev (91 commits)")[![jmleroux](https://avatars.githubusercontent.com/u/1516770?v=4)](https://github.com/jmleroux "jmleroux (43 commits)")[![liuggio](https://avatars.githubusercontent.com/u/530406?v=4)](https://github.com/liuggio "liuggio (25 commits)")[![AlessandroMinoccheri](https://avatars.githubusercontent.com/u/3356506?v=4)](https://github.com/AlessandroMinoccheri "AlessandroMinoccheri (14 commits)")[![garak](https://avatars.githubusercontent.com/u/179866?v=4)](https://github.com/garak "garak (12 commits)")[![antonkomarev](https://avatars.githubusercontent.com/u/1849174?v=4)](https://github.com/antonkomarev "antonkomarev (10 commits)")[![ricardoboss](https://avatars.githubusercontent.com/u/6266356?v=4)](https://github.com/ricardoboss "ricardoboss (7 commits)")[![GregOriol](https://avatars.githubusercontent.com/u/3975044?v=4)](https://github.com/GregOriol "GregOriol (5 commits)")[![aptyp4uk1337](https://avatars.githubusercontent.com/u/44950042?v=4)](https://github.com/aptyp4uk1337 "aptyp4uk1337 (4 commits)")[![fefas](https://avatars.githubusercontent.com/u/6557756?v=4)](https://github.com/fefas "fefas (2 commits)")[![Jean85](https://avatars.githubusercontent.com/u/6729988?v=4)](https://github.com/Jean85 "Jean85 (1 commits)")[![Haehnchen](https://avatars.githubusercontent.com/u/1011712?v=4)](https://github.com/Haehnchen "Haehnchen (1 commits)")[![PeterDaveHello](https://avatars.githubusercontent.com/u/3691490?v=4)](https://github.com/PeterDaveHello "PeterDaveHello (1 commits)")

---

Tags

badge-poserhacktoberfestphpphp-libraryposercomposerbadgepinpackagist

###  Code Quality

TestsPHPUnit

Static AnalysisPsalm

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/badges-poser/health.svg)

```
[![Health](https://phpackages.com/badges/badges-poser/health.svg)](https://phpackages.com/packages/badges-poser)
```

###  Alternatives

[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

103519.9k53](/packages/friendsoftypo3-content-blocks)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

5186.0k18](/packages/phel-lang-phel-lang)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
