{"id":29696402,"url":"https://github.com/hirotakadango/php-music","last_synced_at":"2026-02-25T22:08:41.046Z","repository":{"id":172303460,"uuid":"649114956","full_name":"HirotakaDango/PHP-Music","owner":"HirotakaDango","description":"A simple, fast, and modern self-hosted music player built in PHP, with a clean UI, SQLite backend, and full PWA (Progressive Web App) features. Scan your music collection, play songs in your browser, manage favorites/playlists, upload and edit your own songs, and more—all in one lightweight app.","archived":false,"fork":false,"pushed_at":"2025-09-10T17:20:41.000Z","size":2904,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-01-22T17:52:14.019Z","etag":null,"topics":["music","music-player","music-player-application","php","single-file-app","sqlite"],"latest_commit_sha":null,"homepage":"https://hirotakadango.github.io/php-music-wiki/","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HirotakaDango.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2023-06-03T20:33:42.000Z","updated_at":"2026-01-13T18:19:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"e1c01da0-39b3-4309-8bc2-2dbd8d08a6ec","html_url":"https://github.com/HirotakaDango/PHP-Music","commit_stats":null,"previous_names":["hirotakadango/music-player","hirotakadango/php-music"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/HirotakaDango/PHP-Music","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HirotakaDango%2FPHP-Music","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HirotakaDango%2FPHP-Music/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HirotakaDango%2FPHP-Music/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HirotakaDango%2FPHP-Music/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HirotakaDango","download_url":"https://codeload.github.com/HirotakaDango/PHP-Music/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HirotakaDango%2FPHP-Music/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29843052,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-25T21:18:31.832Z","status":"ssl_error","status_checked_at":"2026-02-25T21:18:29.265Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["music","music-player","music-player-application","php","single-file-app","sqlite"],"created_at":"2025-07-23T09:38:01.727Z","updated_at":"2026-02-25T22:08:41.014Z","avatar_url":"https://github.com/HirotakaDango.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PHP Music\n\nA simple, fast, and modern self-hosted music player built in PHP, with a clean UI, SQLite backend, and full PWA (Progressive Web App) features. Scan your music collection, play songs in your browser, manage favorites/playlists, upload and edit your own songs, and more—all in one lightweight app.\n\n![1](https://raw.githubusercontent.com/HirotakaDango/php-music-wiki/refs/heads/main/1.png)\n![2](https://raw.githubusercontent.com/HirotakaDango/php-music-wiki/refs/heads/main/2.png) \n[![Star History Chart](https://api.star-history.com/svg?repos=HirotakaDango/PHP-Music\u0026type=Date)](https://www.star-history.com/#HirotakaDango/PHP-Music\u0026Date)\n\n---\n\n## Features\n\n- 🎵 **Scan Local Music**: Recursively scans your directory for `mp3`, `m4a`, `flac`, `ogg`, and `wav` files (excluding uploads).\n- 🏷️ **Automatic Metadata**: Uses [getID3](https://github.com/JamesHeinrich/getID3) to extract artist, album, year, genre, and cover images.\n- 📚 **Library Management**: Browse by songs, artists, albums, genres, or favorites. Instant search included.\n- ❤️ **Favorites**: Mark/unmark songs as favorites. Drag to reorder in \"Favorites\" view. Import/export supported.\n- 🔊 **Player**: Play, pause, next/prev, repeat, shuffle, seek, and cover art display. In-browser playback via HTML5 `\u003caudio\u003e`. Media Session API support.\n- 🖼️ **Album Art**: Displays embedded images as `.webp` (SVG fallback if missing).\n- 📱 **Responsive UI**: Mobile-optimized, fast, and touch-friendly.\n- ⚡ **PWA Support**: Install as an app on your phone or desktop. Works offline (caches static assets \u0026 some API). Manifest \u0026 service worker included.\n- 🚀 **No Database Setup**: Uses SQLite, auto-initialized on first run.\n- 👤 **User Accounts**: Register/login. Each user can upload their own music, manage their own favorites and uploads.\n- ☁️ **Upload Music**: Upload new songs (multi-file, genre auto-detected from file/tag or custom). Each user can upload up to 10 songs per day (daily limit, reset at midnight).\n- 🏷️ **Edit Genre**: Change genre from the context menu (only on your own uploads or as admin).\n- 🗑️ **Delete Songs**: Delete your own uploads from the UI/context menu.\n- ⬇️ **Download Songs**: Download your uploads directly from the context menu.\n- 🔐 **Session Security**: All write actions require login. Uploads require account verification by an admin.\n- 🛠️ **Settings**: Change password and manage your account and profile picture.\n- 🏢 **Admin Panel**: Admin can verify/un-verify user accounts, view user stats, and manage verification for uploads.\n- 🎶 **Playlists**: Create, manage, and reorder custom playlists for your favorite tracks.\n- 🔄 **Drag-and-drop Ordering**: Reorder favorites and playlist songs by dragging.\n- 🔗 **Shareable Views**: Share direct links to songs, albums, artists, and playlists with others.\n- 🗂️ **Infinite Scroll and Pagination**: Large libraries load smoothly with infinite scroll support.\n- 📑 **Metadata View**: View song metadata (title, artist, album, genre, year, duration) from the context menu.\n- 🆘 **Emergency Rescan**: If the library is corrupted or missing, an emergency scan can be performed to rebuild the database.\n- 👤 **Profile Pictures**: Upload and manage your profile picture.\n- 📊 **User Statistics**: View your uploads, favorites, playlists, and play count from the user stats page.\n- 📈 **Recommendations**: \"For You\" tab gives recommendations based on your play history, favorites, and genres.\n\n---\n\n## Demo\n\n[Try it here.](http://phpmusic.rf.gd/)\n\n---\n\n## Requirements\n\n- PHP 7.4+ with `pdo_sqlite`, `gd`, and `mbstring` extensions enabled.\n- [getID3 library](https://github.com/JamesHeinrich/getID3) (extract to a `getid3` folder inside the project).\n- A folder full of music files!\n\n---\n\n## How to Activate SQLite in XAMPP/LAMPP\n\nIf you are using **XAMPP** or **LAMPP** and encounter issues with SQLite:\n\n### For XAMPP (Windows/macOS)\n\n1. Open your `php.ini` file (usually found in `xampp/php/php.ini`).\n2. Ensure these lines are **not** commented (remove the leading semicolon `;` if present):\n\n    ```\n    extension=pdo_sqlite\n    extension=sqlite3\n    ```\n\n3. Save and restart Apache using the XAMPP control panel.\n\n### For LAMPP (Linux)\n\n1. Open `/opt/lampp/etc/php.ini`.\n2. Ensure:\n\n    ```\n    extension=pdo_sqlite\n    extension=sqlite3\n    ```\n\n3. Save and restart Apache:\n\n    ```bash\n    sudo /opt/lampp/lampp restart\n    ```\n\n### Verify SQLite is enabled\n\n- Create a `phpinfo.php` file:\n\n    ```php\n    \u003c?php phpinfo(); ?\u003e\n    ```\n- Open in your browser and search for \"sqlite\" or \"PDO drivers\". You should see `sqlite3` and `pdo_sqlite` enabled.\n\n---\n\n## Installation\n\n1. **Clone the repo:**\n\n    ```bash\n    git clone https://github.com/HirotakaDango/PHP-Music.git\n    cd PHP-Music\n    ```\n\n2. **Download getID3:**\n\n    - [Download latest getID3](https://github.com/JamesHeinrich/getID3/releases)\n    - Extract as a `getid3` folder inside the project root:\n      ```\n      PHP-Music/\n        index.php\n        getid3/\n          getid3.php\n          ...\n      ```\n\n3. **Place music files:**\n\n    - Put your music files in the root folder or any subfolder (except `uploads/`).\n    - The player recursively scans for supported audio files.\n\n4. **Set permissions (if needed):**\n\n    - PHP must be able to write to `music.db` in the project directory.\n    - For uploads, ensure the `uploads/` folder (auto-created) is writable by PHP.\n\n5. **Run with your favorite PHP server:**\n\n    - Built-in server (for testing):\n      ```bash\n      php -S localhost:8000\n      ```\n    - Or use with Apache/Nginx as a standard PHP site.\n\n6. **Open in browser:**\n\n    - Go to [http://localhost:8000](http://localhost:8000)\n    - Register a user account to unlock uploading and library scanning.\n    - **IMPORTANT:** After registering, an admin must verify your account before you can upload music (see below).\n    - Click \"Scan Library\" to index your music folder.\n\n---\n\n## Usage\n\n- **Register/Login**: Create a user account for full features (upload, scan, delete, edit, favorites, playlists).\n- **Profile Picture**: Set or change your profile picture from the settings modal (accepts PNG, JPG, GIF).\n- **Account Verification**: After registering, your account must be verified by an admin before you can upload music. Unverified users can still scan, browse, and play music.\n- **Upload Limit**: Each user can upload up to 10 songs per day (reset at midnight).\n- **Scan Library**: Click \"Scan All\" in the sidebar to index or refresh your library (scans all music except uploads).\n- **Emergency Rescan**: If the database is missing or corrupted, an emergency rescan can be triggered from the UI or by using a special action to rebuild your music library.\n- **Browse**: Use the sidebar to view all songs, favorites, albums, artists, genres, or your own uploads.\n- **Playlists**: Create, edit, and drag-to-reorder your own custom playlists. Add/remove songs easily.\n- **Search**: Use the search bar (desktop/mobile) to instantly find songs, albums, or artists.\n- **Play Music**: Click a song to play, or use the player controls at the bottom.\n- **Favorites**: Click the heart icon to add/remove from favorites. Drag to reorder in \"Favorites\" view.\n- **Edit Genre**: Right-click (or tap \"...\" on mobile) a song and choose \"Edit Genre\" (your own uploads or as admin).\n- **Upload Music**: Click \"Upload Song\". You can upload multiple files at once; genre is auto-detected but can be overridden. **Upload limit:** 10 songs per user per day (resets at midnight).\n- **Delete/Download**: Use context menu on your uploads to delete or download.\n- **Share**: Click the \"Share\" button on albums, artists, playlists, or songs to get a shareable link.\n- **PWA**: Click \"Install App\" (sidebar) if your browser supports PWAs. Works offline for playback and browsing.\n- **Infinite Scroll**: Large libraries auto-load more songs as you scroll.\n- **Context Menus**: Right-click or tap \"...\" for per-song actions like share, add to playlist, edit genre, delete, etc.\n- **Metadata View**: View song metadata (title, artist, album, genre, year, duration) via context menu.\n- **Recommendations**: Use the \"For You\" page for personalized recommendations based on your listening and favorites.\n- **User Statistics**: Access your uploads, favorites, playlists, and total play count from the \"Statistics\" (profile menu).\n\n---\n\n### Admin Panel\n\n- Go to `?access=admin` (e.g., `http://localhost:8000/?access=admin`)\n- Default Admin Password: `admin`\n- Admin can verify/un-verify user accounts, view user details, and manage verification status for uploads.\n- Admin can also edit/delete any song.\n\n---\n\n## How does it work?\n\n- **index.php** is both the backend API (`?action=...`) and the single-page frontend.\n- User authentication is session-based (server-side PHP sessions).\n- User uploads are separated—each user can only manage their own uploads.\n- Scanning uses getID3 for metadata and album art, storing info in `music.db` (SQLite).\n- Album art is extracted, resized, and converted to `.webp`.\n- Playback via JavaScript and HTML5 `\u003caudio\u003e`, with Media Session API support.\n- PWA support includes manifest and service worker (`?pwa=manifest`, `?pwa=sw`).\n- Uploads are stored in `/uploads/{artist}/` and are only accessible to the uploader or admin.\n- Only the uploading user (or admin) can edit genre, delete, or download their uploads.\n- Playlists and favorites support drag-and-drop ordering.\n- Shareable views use query parameters for albums, artists, playlists, or specific songs.\n- **Emergency Scan**: If the music database is missing or corrupted, the app can attempt to rebuild it by rescanning the music directory.\n- **Profile Pictures**: Handled securely via the `upload_profile_picture` action and stored as webp images in the database.\n- **User Stats**: Gathered via dedicated endpoints and displayed in the stats view.\n\n---\n\n## Customization\n\n- **Colors**: Edit CSS variables in `\u003cstyle\u003e` inside `index.php`.\n- **Audio formats**: Adjust the regex in `scan_music_directory()` in `index.php` to add more formats.\n- **Remote sources**: Would require backend refactoring.\n- **Public/Internet use**: Add your own authentication and security features (see below).\n\n---\n\n## Security\n\n- **Warning:** Intended for personal use on your own server or LAN.\n- Do **NOT** expose this directly to the public Internet without additional security.\n- Each user has their own uploads, favorites, and permissions. Only their own uploads can be deleted/edited/downloaded.\n- Users must be verified by an admin before uploading music.\n- All write actions and uploads require login and a verified account.\n- Admin panel is protected by password.\n\n---\n\n## Troubleshooting\n\n- **Scan errors**: Ensure `getid3/` exists and is accessible, and PHP can read music files and write `music.db`. If the database is missing/corrupt, use the emergency rescan.\n- **Upload errors**: Make sure the `uploads/` directory is writable and PHP settings allow large enough uploads (`upload_max_filesize`, `post_max_size`). Ensure your account is verified.\n- **Missing album art**: Some files may lack embedded images (default SVG will show).\n- **Playback issues**: Browser support for some formats (like FLAC) may be limited.\n- **Genre not showing**: Use \"Edit Genre\" from the context menu to update.\n- **Profile picture issues**: Only PNG, JPG, and GIF files are supported (converted to webp).\n\n---\n\nEnjoy your self-hosted PHP music player!  \nContributions and feedback welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirotakadango%2Fphp-music","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhirotakadango%2Fphp-music","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhirotakadango%2Fphp-music/lists"}