badges / poser
Poser, add badges on your readme..
Fund package maintenance!
paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=ETT4JRJARLTSC
JellyBellyDev
AlessandroMinoccheri
Installs: 73 047
Dependents: 10
Suggesters: 0
Security: 0
Stars: 139
Watchers: 9
Forks: 43
Open Issues: 11
Type:lib
pkg:composer/badges/poser
Requires
- php: ^8.1
- ext-gd: *
- ext-simplexml: *
- cybercog/php-svg-font: ^1.0
- kartsims/easysvg: ^2.5
- symfony/console: ^5.0 || ^6.0 || ^7.0 || ^8.0
Requires (Dev)
- behat/behat: ^3.13
- friendsofphp/php-cs-fixer: ^3.41
- phpunit/phpunit: ^10.5 | ^11.5 | ^12.0
- vimeo/psalm: ^6.13
- v3.3.0
- v3.2.0
- V3.1.1
- v3.1.0
- v3.0.0
- dev-master / 2.x-dev
- v2.3.1
- v2.3.0
- v2.2.0
- v2.1.0
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- 1.4.x-dev
- v1.4.1
- v1.4.0
- v1.3.0
- v1.2.2
- 1.2.1
- v1.2.0
- v1.1
- v1.0
- dev-feat/social-badge
- dev-fix/yaml-syntax
- dev-feat/add-compatibility-sf6
- dev-feat/phar-archive
- dev-feat/add-compatibility-with-php80
- dev-fixup/link-to-badge-poser
This package is not auto-updated.
Last update: 2026-01-21 08:35:12 UTC
README
This is a php library that creates badges like and
and
,
according to Shields specification.
This library is used by https://poser.pugx.org
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
1. Create a project
composer create-project badges/poser ln -s poser/bin/poser /usr/local/bin/poser
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"
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
1. Add to composer dependencies
composer require badges/poser
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, and for-the-badge.
Examples (generated with make doc-images)
Encoding
Dashes -- → - Dash
Underscores __ → _ Underscore
_ or Space → Space
More
For more info please see the behat features and the examples in the php-spec folder
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
Active contribution and patches are very welcome.
Please refer to CONTRIBUTING
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
CONTAINER=php83 make setup
2. Run the tests
CONTAINER=php83 make tests
3. Run the tests for all PHP versions
make matrix-tests