{"id":20672796,"url":"https://github.com/selective-php/audio-type","last_synced_at":"2025-04-19T19:10:29.029Z","repository":{"id":35102329,"uuid":"206956953","full_name":"selective-php/audio-type","owner":"selective-php","description":"Audio format detector for PHP","archived":false,"fork":false,"pushed_at":"2023-09-09T12:32:10.000Z","size":5473,"stargazers_count":5,"open_issues_count":0,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T12:04:51.160Z","etag":null,"topics":["audio","audio-formats","audio-library","php"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/selective-php.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-09-07T11:14:34.000Z","updated_at":"2022-02-07T01:42:03.000Z","dependencies_parsed_at":"2022-08-08T05:01:12.294Z","dependency_job_id":null,"html_url":"https://github.com/selective-php/audio-type","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Faudio-type","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Faudio-type/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Faudio-type/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/selective-php%2Faudio-type/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/selective-php","download_url":"https://codeload.github.com/selective-php/audio-type/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249773125,"owners_count":21323396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["audio","audio-formats","audio-library","php"],"created_at":"2024-11-16T20:38:50.478Z","updated_at":"2025-04-19T19:10:28.966Z","avatar_url":"https://github.com/selective-php.png","language":"PHP","readme":"# selective/audio-type\n\nAudio format detection library for PHP.\n\n[![Latest Version on Packagist](https://img.shields.io/github/release/selective-php/audio-type.svg)](https://packagist.org/packages/selective/audio-type)\n[![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg)](LICENSE)\n[![build](https://github.com/selective-php/audio-type/workflows/build/badge.svg)](https://github.com/selective-php/audio-type/actions)\n[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/selective-php/audio-type.svg)](https://scrutinizer-ci.com/g/selective-php/audio-type/code-structure)\n[![Quality Score](https://img.shields.io/scrutinizer/quality/g/selective-php/audio-type.svg)](https://scrutinizer-ci.com/g/selective-php/audio-type/?branch=master)\n[![Total Downloads](https://img.shields.io/packagist/dt/selective/audio-type.svg)](https://packagist.org/packages/selective/audio-type/stats)\n\n\n## Features\n\n* Detection of the audio type based on its header\n* No dependencies\n* Very fast\n\n### Supported formats\n\n* **MP3** (MPEG-1 Audio Layer III)\n* **WAV** (WAVE PCM soundfile format)\n* **MIDI** (Musical Instrument Digital Interface)\n* **FLAC** (Free Lossless Audio Codec)\n* **OGA** (OGG Vorbis sound format)\n* **MKA** (Audio-only Matroska container)\n* **WEBM** (Audio only)\n* **RealAudio** (It contains only audio)\n* **AIFF** (Audio Interchange File Format)\n* **CAF** (Apple Core Audio File)\n* **AAC** (Advanced Audio Coding)\n* **WMA** (Windows Media Audio)\n* **RMI** (RIFF-MIDI Audio)\n* **AU** (AU Audio)\n\n## Requirements\n\n* PHP 8.1+\n\n## Installation\n\n```\ncomposer require selective/audio-type\n```\n\n## Usage\n\n### Detect the audio type of file\n\n```php\nuse Selective\\AudioType\\AudioTypeDetector;\nuse Selective\\AudioType\\Provider\\DefaultAudioProvider;\nuse SplFileObject;\n\n$file = new SplFileObject('example.mp3');\n\n$detector = new AudioTypeDetector();\n\n// Add audio detectors\n$detector-\u003eaddProvider(new DefaultAudioProvider());\n$audioType = $detector-\u003egetAudioTypeFromFile($file);\n\n// Get the audio format\necho $audioType-\u003egetFormat(); // mp3\n\n// Get the mime type\necho $audioType-\u003egetMimeType(); // audio/mp3\n```\n\n### Detect the audio type of in-memory object\n\n```php\nuse Selective\\AudioType\\AudioTypeDetector;\nuse Selective\\AudioType\\Provider\\DefaultAudioProvider;\nuse SplTempFileObject;\n\n$audio = new SplTempFileObject();\n\n$audio-\u003efwrite('my file content');\n\n$detector = new AudioTypeDetector();\n\n// Add audio detectors\n$detector-\u003eaddProvider(new DefaultAudioProvider());\n\necho $detector-\u003egetAudioTypeFromFile($audio)-\u003egetFormat();\n```\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE) for more information.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselective-php%2Faudio-type","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fselective-php%2Faudio-type","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fselective-php%2Faudio-type/lists"}