Introduction
PHP Music is an open-source, web-based, self-hosted music platform. Enjoy your music library anywhere, with a beautiful dark UI and responsive design inspired by YouTube Music. Features include user accounts, uploads, playlists, favorites, PWA, admin tools, and moreโall in a single PHP file!
- ๐ต Upload, organize, and play your music from anywhere.
- ๐ User accounts with verification and daily upload limits.
- ๐ฑ Progressive Web App (PWA) support: install on your phone!
- ๐ผ๏ธ Modern dark theme and responsive layout.
- ๐ ๏ธ Admin panel for user management.
Features
Upload, edit, and delete your own songs. Organize by artist, album, or genre. Create favorites and playlists. Drag and drop to reorder lists.
Register as a user, manage your profile, set a profile picture, change your password, and upload music (with verification).
Upload up to 10 songs per day (default, configurable). Supported: MP3, FLAC, M4A, OGG, WAV, and more. Admin must verify users for uploads.
Sleek, dark, mobile-first interface inspired by YouTube Music. Responsive design using Bootstrap 5.
Manage users, verify/unverify accounts, and monitor uploads from a secure admin dashboard. Toggle user verification and see daily upload stats.
Add to Home Screen on your device for an app-like experience. Works offline (static assets, cached content, and player UI).
Tracks recent plays and suggests music based on your listening history and favorites. "For You" section with personalized shelves.
Installation
- Clone the repository:
git clone https://github.com/HirotakaDango/PHP-Music-Player.git
- Install dependencies:
- PHP 7.4+ (
pdo_sqlite
, gd
)
- Web server (Apache/Nginx) or PHP built-in server
- getID3 library (included as
getid3/
folder)
- Set permissions:
chmod -R 755 uploads/
- Run the app:
php -S localhost:8080
Or deploy to your webserver's public directory.
- Visit:
http://localhost:8080/
Security Tip: Change the ADMIN_PASSWORD
in index.php
before going public!
Usage
As a user you can:
- Register with your email & artist name
- Wait for admin verification to upload music
- Upload music (MP3, FLAC, etc.), edit genres, and create playlists
- Create, reorder (drag & drop), and share playlists
- Mark favorites, search by title, artist, album, or genre
- Set a profile picture (WebP processed)
Music Playback:
- Click a song to play; use the player bar for controls (play/pause/skip/shuffle/repeat/volume)
- Supports background playback (PWA + mobile)
- Drag and drop to reorder favorites and playlists
- Sharing: click to copy/share links for songs, albums, artists, or playlists
- Stream, download, and view song metadata
For advanced usage and integrations, see the
API endpoints below.
Admin Panel
- Access via
?access=admin
(e.g., http://localhost:8080/?access=admin
)
- Login with admin password (default:
admin
โ change this!)
- View and verify users, toggle their upload rights
- Paginate users, see upload counts and last upload date
- Log out securely with the button
Only admins (server owners) can verify users and manage accounts. User verification is required to upload music.
API Endpoints
Endpoint |
Method |
Description |
?action=register |
POST (json) |
Register new user (email , artist , password ) |
?action=login |
POST (json) |
Login (email , password ) |
?action=get_session |
GET |
Get current session status and user info |
?action=upload_song |
POST (form-data) |
Upload a song file (verified users only, MP3/FLAC/M4A/OGG/WAV, daily limit applies) |
?action=delete_song |
POST (json) |
Delete a song (owner or admin only) |
?action=get_songs |
GET |
List all songs (supports sort , page , artist , album , genre ) |
?action=toggle_favorite |
POST (json) |
Add or remove favorite song |
?action=create_playlist |
POST (json) |
Create a new playlist |
?action=get_user_playlists |
GET |
List your playlists |
?action=get_playlist_songs&public_id=ID |
GET |
Get songs in a playlist |
?action=get_stream&id=SONG_ID |
GET |
Stream audio file (with HTTP Range support) |
?action=search&q=QUERY |
GET |
Search songs by title, artist, or album |
?action=get_recommendations |
GET |
Get personalized recommendations ("For You") |
All API endpoints return application/json
unless streaming.
FAQ
Open the site in your browser (Chrome/Safari/Edge), tap the menu (โฎ) and select Add to Home Screen. The app installs as a PWA!
MP3, M4A, FLAC, OGG, WAV, and more (as supported by your browser via audio
tag).
Register an account, then ask your site admin to verify your account for uploads. Admin can toggle verification from the admin panel.
Yes! Edit the :root
variables in the CSS for your own color palette.
Use the "Scan All" button or visit ?action=full_scan
to resync the database with your music folder using getID3.
Progressive Web App (PWA)
- Automatically provides
manifest.json
and service-worker
for offline support (?pwa=manifest
, ?pwa=sw
)
- Installable on mobile and desktop (works offline for static assets and recent songs)
- Customizable app icon and theme color (
?action=get_app_icon
)
- No extra configuration needed!
Tip: If you update the app, users may need to refresh for cache updates.
https://your-domain/index.php?pwa=manifest
https://your-domain/index.php?pwa=sw
License
MIT License โ Free for personal and commercial use.
GitHub Repo →