PHPackages                             perry-rylance/midi-php - 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. perry-rylance/midi-php

ActiveLibrary

perry-rylance/midi-php
======================

Read, build and write MIDI files, tracks and events in PHP

1.0.1(8mo ago)038↓100%MITPHPPHP &gt;=8.2.0CI passing

Since Jul 21Pushed 8mo agoCompare

[ Source](https://github.com/PerryRylance/midi-php)[ Packagist](https://packagist.org/packages/perry-rylance/midi-php)[ Docs](https://github.com/PerryRylance/midi-php)[ RSS](/packages/perry-rylance-midi-php/feed)WikiDiscussions dev Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (3)Used By (0)

midi-php
========

[](#midi-php)

A package for reading and writing MIDI files and streams in PHP.

Usage
-----

[](#usage)

### Reading MIDI data

[](#reading-midi-data)

- Get your data into a binary string
- Instantiate a `new ReadStream` with your binary data
- Instantiate a `new File`
- Call `readBytes` passing in your `ReadStream`

### Creating MIDI data

[](#creating-midi-data)

- Instantiate a `new File`
- Instantiate a `new Track` and push it to your files `tracks`
- Instantiate any subclasses of `Event` you need, eg `NoteOnEvent`
- Push your events to the tracks `events`
- Don't forget `EndOfTrackEvent`!

### Writing MIDI data

[](#writing-midi-data)

- You'll need a `File` either read in or created from scratch as described above
- Instantiate a `new WriteStream`
- Call `writeBytes` on your `File` passing in your `WriteStream`
- Use `toBinary` on your `WriteStream` to get the binary data

Development
-----------

[](#development)

`-dev` containers with XDebug are provided and will stay open once started.

Testing
-------

[](#testing)

All tests can be run with `cross-version-tests.sh`.

Tests can be run on specific versions by starting the respective containers.

Credits
-------

[](#credits)

- With thanks to [Recording Blogs](https://www.recordingblogs.com/wiki/musical-instrument-digital-interface-midi), [Teragon Audio](http://midi.teragonaudio.com/tech/midispec/run.htm) and [Mido](https://mido.readthedocs.io/en/latest/meta_message_types.html) for insight into the MIDI spec.
- With thanks to [jazz-soft](https://github.com/jazz-soft/test-midi-files) for the test files.
- With thanks to Jeff Boudier for [MIDIopsy](https://github.com/jeffbourdier/MIDIopsy/releases/tag/v1.2)

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance59

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity50

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

Every ~35 days

Total

2

Last Release

257d ago

PHP version history (2 changes)1.0.0PHP &gt;=8.0.0

1.0.1PHP &gt;=8.2.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/35a517d8044830b0a015a9b7284ce900de922292ac8298b5b6320354cd19f470?d=identicon)[PerryRylance](/maintainers/PerryRylance)

---

Top Contributors

[![PerryRylance](https://avatars.githubusercontent.com/u/14136738?v=4)](https://github.com/PerryRylance "PerryRylance (57 commits)")

---

Tags

midi

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/perry-rylance-midi-php/health.svg)

```
[![Health](https://phpackages.com/badges/perry-rylance-midi-php/health.svg)](https://phpackages.com/packages/perry-rylance-midi-php)
```

###  Alternatives

[tmont/midiparser

MIDI parsing library

3759.4k](/packages/tmont-midiparser)

PHPackages © 2026

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