PHPackages                             selective/audio-type - 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. [Image &amp; Media](/categories/media)
4. /
5. selective/audio-type

ActiveLibrary[Image &amp; Media](/categories/media)

selective/audio-type
====================

Audio format detection

1.4.0(2mo ago)5817MITPHPPHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI failing

Since Oct 12Pushed 2mo ago2 watchersCompare

[ Source](https://github.com/selective-php/audio-type)[ Packagist](https://packagist.org/packages/selective/audio-type)[ Docs](https://github.com/selective-php/audio-type)[ RSS](/packages/selective-audio-type/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (5)Dependencies (4)Versions (6)Used By (0)

selective/audio-type
====================

[](#selectiveaudio-type)

Audio format detection library for PHP.

[![Latest Version on Packagist](https://camo.githubusercontent.com/2a38bb66348f4fe79680c25f223f61318ac38457381c6e3e7f85bed160b4f399/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f72656c656173652f73656c6563746976652d7068702f617564696f2d747970652e737667)](https://packagist.org/packages/selective/audio-type)[![Software License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![build](https://github.com/selective-php/audio-type/workflows/build/badge.svg)](https://github.com/selective-php/audio-type/actions)[![Coverage Status](https://camo.githubusercontent.com/9d59e6e3b0291406872f2ee8557d17bce70cbfbb99742fe26a5057bcefc0527b/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f636f7665726167652f672f73656c6563746976652d7068702f617564696f2d747970652e737667)](https://scrutinizer-ci.com/g/selective-php/audio-type/code-structure)[![Quality Score](https://camo.githubusercontent.com/6ebdc4110edc423bf64cda73cc715bd824dc03ea76794913ffa0ed4207cf6497/68747470733a2f2f696d672e736869656c64732e696f2f7363727574696e697a65722f7175616c6974792f672f73656c6563746976652d7068702f617564696f2d747970652e737667)](https://scrutinizer-ci.com/g/selective-php/audio-type/?branch=master)[![Total Downloads](https://camo.githubusercontent.com/bc2bd6ab75cb932704c5657d31bbcd454016ca80c863482e514f215b9081be5d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656c6563746976652f617564696f2d747970652e737667)](https://packagist.org/packages/selective/audio-type/stats)

Features
--------

[](#features)

- Detection of the audio type based on its header
- No dependencies
- Very fast

### Supported formats

[](#supported-formats)

- **MP3** (MPEG-1 Audio Layer III)
- **WAV** (WAVE PCM soundfile format)
- **MIDI** (Musical Instrument Digital Interface)
- **FLAC** (Free Lossless Audio Codec)
- **OGA** (OGG Vorbis sound format)
- **MKA** (Audio-only Matroska container)
- **WEBM** (Audio only)
- **RealAudio** (It contains only audio)
- **AIFF** (Audio Interchange File Format)
- **CAF** (Apple Core Audio File)
- **AAC** (Advanced Audio Coding)
- **WMA** (Windows Media Audio)
- **RMI** (RIFF-MIDI Audio)
- **AU** (AU Audio)

Requirements
------------

[](#requirements)

- PHP 8.1 - 8.5

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

[](#installation)

```
composer require selective/audio-type

```

Usage
-----

[](#usage)

### Detect the audio type of file

[](#detect-the-audio-type-of-file)

```
use Selective\AudioType\AudioTypeDetector;
use Selective\AudioType\Provider\DefaultAudioProvider;
use SplFileObject;

$file = new SplFileObject('example.mp3');

$detector = new AudioTypeDetector();

// Add audio detectors
$detector->addProvider(new DefaultAudioProvider());
$audioType = $detector->getAudioTypeFromFile($file);

// Get the audio format
echo $audioType->getFormat(); // mp3

// Get the mime type
echo $audioType->getMimeType(); // audio/mp3
```

### Detect the audio type of in-memory object

[](#detect-the-audio-type-of-in-memory-object)

```
use Selective\AudioType\AudioTypeDetector;
use Selective\AudioType\Provider\DefaultAudioProvider;
use SplTempFileObject;

$audio = new SplTempFileObject();

$audio->fwrite('my file content');

$detector = new AudioTypeDetector();

// Add audio detectors
$detector->addProvider(new DefaultAudioProvider());

echo $detector->getAudioTypeFromFile($audio)->getFormat();
```

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

53

—

FairBetter than 97% of packages

Maintenance85

Actively maintained with recent releases

Popularity17

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity79

Established project with proven stability

 Bus Factor1

Top contributor holds 59.4% 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 ~581 days

Total

5

Last Release

80d ago

PHP version history (3 changes)1.0.0PHP ^7.1

1.2.0PHP ^7.3 || ^8.0

1.4.0PHP ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/89d408d7f6ed65cdbeba70a2da2d0a8a1135fc37ebc07c44989f509221cc91bd?d=identicon)[odan](/maintainers/odan)

---

Top Contributors

[![odan](https://avatars.githubusercontent.com/u/781074?v=4)](https://github.com/odan "odan (41 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (20 commits)")[![ivebe](https://avatars.githubusercontent.com/u/4104576?v=4)](https://github.com/ivebe "ivebe (5 commits)")[![heinrichschiller](https://avatars.githubusercontent.com/u/25958414?v=4)](https://github.com/heinrichschiller "heinrichschiller (1 commits)")[![mleko](https://avatars.githubusercontent.com/u/2631527?v=4)](https://github.com/mleko "mleko (1 commits)")[![qligier](https://avatars.githubusercontent.com/u/3299399?v=4)](https://github.com/qligier "qligier (1 commits)")

---

Tags

audioaudio-formatsaudio-libraryphptypevideoformat

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/selective-audio-type/health.svg)

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

###  Alternatives

[php-ffmpeg/php-ffmpeg

FFMpeg PHP, an Object Oriented library to communicate with AVconv / ffmpeg

5.0k21.7M165](/packages/php-ffmpeg-php-ffmpeg)[danog/madelineproto

Async PHP client API for the telegram MTProto protocol.

3.4k855.0k18](/packages/danog-madelineproto)[vimeo/vimeo-api

Official PHP library for the Vimeo API.

4637.1M32](/packages/vimeo-vimeo-api)[vimeo/laravel

A Vimeo bridge for Laravel

4161.5M4](/packages/vimeo-laravel)[codescale/ffmpeg-php

PHP wrapper for FFmpeg application

495270.5k1](/packages/codescale-ffmpeg-php)[opentok/opentok

OpenTok is a platform for creating real time streaming video applications, created by TokBox.

1413.0M10](/packages/opentok-opentok)

PHPackages © 2026

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