PHPackages                             ucscode/php-svg-piano - 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. ucscode/php-svg-piano

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

ucscode/php-svg-piano
=====================

A PHP library for generating SVG representations of a piano keyboard with customizable styles and note highlights.

2.0.0(1y ago)02MITPHPPHP &gt;=8.2

Since Feb 22Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ucscode/php-svg-piano)[ Packagist](https://packagist.org/packages/ucscode/php-svg-piano)[ RSS](/packages/ucscode-php-svg-piano/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

PhpSvgPiano
===========

[](#phpsvgpiano)

*PhpSvgPiano is a PHP library for generating SVG representations of a piano keyboard with customizable styles and note highlights.*

> PhpSvgPiano was inspired by the [Svguitar](https://github.com/omnibrain/svguitar) library and brings a similar SVG-based approach to piano visualization.

### Features

[](#features)

- Generate a scalable SVG piano keyboard
- Highlight pressed keys
- Customize key colors and text styles
- Define octave range and accidental preferences
- Object-oriented and easy to extend

Installation
------------

[](#installation)

Install via Composer:

```
composer require ucscode/php-svg-piano
```

Usage
-----

[](#usage)

### Basic Example

[](#basic-example)

```
use Ucscode\PhpSvgPiano\Piano;

$piano = new Piano("C4 E4 G4");

echo $piano->render();
```

This will generate an SVG with C4, E4, and G4 pressed.

[![CEG Chord](./docs/images/piano-cmaj.png)](./docs/images/piano-cmaj.png)

---

Documentation
-------------

[](#documentation)

The documentation covers basic information from installation and usage to advanced configuration and customization options.

For detailed information, visit the [documentation page](./docs/index.md).

---

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

[](#contributing)

Contributions are welcome. Feel free to:

- Report issues
- Submit feature requests
- Fork and improve the library

---

License
-------

[](#license)

This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.

### Inspiration

[](#inspiration)

PhpSvgPiano was inspired by the [Svguitar](https://github.com/omnibrain/svguitar) library, which provides an SVG-based approach for rendering guitar chord diagrams. This project extends the concept to the piano, offering a flexible and object-oriented solution for generating customizable SVG piano keyboards.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance46

Moderate activity, may be stable

Popularity2

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

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

Unknown

Total

1

Last Release

440d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/65673b1b31e87471999a7614d107e7e061a38bf72191d149c66c1b943124e09c?d=identicon)[ucscode](/maintainers/ucscode)

---

Top Contributors

[![ucscode](https://avatars.githubusercontent.com/u/34024404?v=4)](https://github.com/ucscode "ucscode (45 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ucscode-php-svg-piano/health.svg)

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

###  Alternatives

[alexandresalome/assetic-extra-bundle

Extra feature for Assetic (asset directory)

1811.4k](/packages/alexandresalome-assetic-extra-bundle)

PHPackages © 2026

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