index.php file. By utilizing an embedded SQLite database (music.db), it offers a seamless deployment experience with no complex database setup required. It boasts a beautiful dark UI inspired by YouTube Music, complete with user accounts, metadata editing, synchronized lyrics, full PWA support, dynamic playlists, collaborative playlist contribution, an advanced audio engine, auto-generated mixes, an integrated Markdown blogging platform, a multi-layered HTML5 image editor, a fully functional rhythm game engine, an integrated PHPEditor IDE, and extensive social sharing functionality.
mp3, m4a, flac, ogg, and wav files.NoSleep.js (silent HTML5 video loop fallback) to prevent mobile display timeouts.
musiclibrary@mail.com) maintains a global override to safely access all private assets.
.zip extraction via context menus, 1-year admin sessions, and file property calculations.
git clone https://github.com/HirotakaDango/PHP-Music.git
cd PHP-Music
getid3/ folder inside the project root folder.
xampp/php/php.ini and remove the semicolon (;) before extension=pdo_sqlite and extension=sqlite3. Restart Apache.music.db and the uploads/ folder.
chmod -R 777 . # Adjust permissions as per your server's security standards
php -S localhost:8080
Open http://localhost:8080 in your browser. Register an account, log into the admin panel (?access=admin, password: admin) to verify yourself, and hit "Scan All" to build your library.
ADMIN_PASSWORD constant in index.php before deploying to a public server!
@username inline will automatically format and highlight the tag for visibility.[00:15.30] Never gonna give you up[00:15.30]Never gonna give you up
PHP Music is built to minimize dependencies while maximizing performance:
index.php file operates both as the client HTML/CSS/JS payload and the backend REST JSON API via the ?action= router.audio and audioB) through dedicated gain nodes to BiquadFilterNodes (EQ), routing into a DynamicsCompressorNode (Volume Normalization) before reaching the audio destination. This enables clean 3-second gapless crossfades.music.db:
users: Manages credentials, profile pictures (WebP blobs), quotas, and verification.music: Stores scanned track details, lyrics, optimized embedded artwork, and the is_private privacy state.favorites & playlist_songs: Pivot tables mapping user relations and custom positional ordering, along with the `added_by` collaborator tracker.playlists: Holds playlist details, collaborative preferences, and the is_private privacy state.playlist_collaborators: Maps authorized editors to specific playlists.offline_songs: Pivot table mapping user-specific offline songs.listen_later: Stores user bookmarks and position maps.personal_notes: Stores sandboxed personal notebook content.tasks: Stores task lists with JSON items, categories, and starred state.blogs: Stores blog titles, markdown content, public/private status, category pointers, and unique 8-byte hexadecimal `public_id` handles.blog_categories: User-defined category mappings for organizing blog posts.blog_comments: Threaded comment trees for blogs with parent-child nesting.blog_reactions & blog_comment_reactions: Tracks user likes and dislikes on blog posts and individual comments.song_reactions: Stores user likes/dislikes on tracks.song_comments: Stores song-level comment logs.comment_reactions: Stores likes/dislikes on individual comments.community_posts: Stores public feed status updates.community_reactions: Stores likes/dislikes on social posts.messages: Stores peer-to-peer direct messages, image attachments, read statuses, and edit tracking.blocks: Stores user-to-user block relationships.history & play_counts: Continuous playback logs (registered after 30 seconds) fueling the recommendations engine.follows: Map representing user-to-user and user-to-artist following relationships.rhythm_scores: Stores personal rhythm game scores, perfect/great/good hit metrics, and maximum combo counts.rhythm_favorites: Pivot table mapping user-specific favorite game tracks.arts, art_files, art_series: PHPShares artwork storage, images, series, and metadata.art_comments, art_comment_reactions: Comments and reactions for artworks.imageditor_projects: Stores image editor project states (JSON) with title, dimensions, category, and starred status.get_stream endpoint natively handles HTTP_RANGE requests. The Service Worker intercepts streams, caching them in browser Cache Storage and generating custom 206 Partial Content range responses on local buffers for perfect offline seeking.Access the administrative dashboard by appending ?access=admin to your URL. Log in using the admin password (default: your admin password). Admin sessions are highly persistent and securely cached in the browser via a 1-year cookie.
?access=admin&page=drive). Features include native .zip extraction via context menus, dynamic URL deep linking for active files, an optimized 2-column mobile grid, and recursive folder property calculations (displaying total files, subdirectories, and byte size).?access=admin&page=ide) featuring a file tree explorer, multi-tab Ace Editor, version history rollback, media viewer, and an interactive terminal console (`git`, `ls`, `pwd`, `php -v`).?access=admin&page=dbmanager) for browsing tables, running SQL queries, inserting/updating/deleting rows, exporting/importing CSV or SQL dumps, managing indexes and foreign keys, and performing maintenance (VACUUM, integrity check).The backend operates via GET/POST requests targeting ?action=.... All responses (except file streams and images) return strict JSON.
| Endpoint | Method | Description |
|---|---|---|
get_session |
GET | Returns active user profile, daily limits, and auth status. |
register / login |
POST | Handles authentication. Requires JSON payload (email, password). Sets active sessions for up to 1 year. |
restore_account |
POST | Restores an account mapping using a generated backup key. |
delete_account_keep_data |
GET | Wipes user credentials and email, but keeps user data (music, notes, tasks, blogs) and generates a backup key. |
upload_profile_picture |
POST | Accepts Multipart form data. Crops image 1:1, resizes to 200px, converts to WebP. |
full_scan |
GET | Recursively syncs disk files with the DB. Triggers getID3 parser for missing files. |
upload_song |
POST | Accepts MP3/FLAC/OGG. Parses ID3 tags immediately. Checks daily limit. |
edit_metadata |
POST | Updates DB and writes ID3v2/Vorbis tags (including lyrics) directly into the audio file. Saves covers in dedicated covers/songs and covers/albums folders. |
get_songs |
GET | Returns paginated songs. Supports parameters: sort, page, artist, album, genre, filter_user_id. |
get_view_data |
GET | Aggregates data for deep links. Supports types: profile, playlist, artist, album. |
get_blogs |
GET | Fetches blog posts. Supports parameters: sort, filter, q (search), artist_id. |
get_blog |
GET | Retrieves a single blog post by its public_id. |
save_blog |
POST | Creates or updates a blog post. |
delete_blog |
POST | Deletes a blog post by ID. |
export_blogs |
GET | Generates a downloadable JSON export of user blogs. |
import_blogs |
POST | Parses an uploaded JSON file and imports blog posts. |
get_blog_comments |
GET | Retrieves threaded comments, parent-child replies, blog reactions, and comment likes/dislikes. |
toggle_blog_reaction |
POST | Registers a like or dislike on a blog post. |
toggle_blog_comment_reaction |
POST | Registers a like or dislike on an individual blog comment. |
add_blog_comment / edit_blog_comment / delete_blog_comment |
POST | Full CRUD operations on blog comments and nested replies. |
get_recommendations |
GET | Generates "For You" shelves based on play_counts, history, and follows. |
log_play |
POST | Logs a playback event (after 30 seconds) to compile user history. |
clear_history |
GET | Wipes all play history and play counts for the logged-in user. |
toggle_favorite |
POST | Adds/removes a song from favorites. |
get_listen_later / get_listen_later_ids |
GET | Fetches detailed metadata lists or raw IDs of bookmarked songs. |
toggle_listen_later |
POST | Adds/removes a song from the listen later bookmarks. |
update_listen_later_order |
POST | Accepts an array of Song IDs to rewrite the position mapping of bookmarks. |
get_notes |
GET | Fetches private sandboxed personal notes. Supports sorting. |
save_note |
POST | Creates a new note or edits an existing note. |
delete_note |
POST | Deletes a specific note. |
get_song_comments |
GET | Fetches comment trees, overall song reactions, and comment likes/dislikes. |
toggle_song_reaction |
POST | Registers a like or dislike on a specific song. |
toggle_comment_reaction |
POST | Registers a like or dislike on an individual comment. |
add_song_comment / edit_song_comment / delete_song_comment |
POST | Full CRUD operations on individual track-level comments. |
get_community |
GET | Fetches public status posts with like/dislike counts and author info. Supports sorting. |
create_community_post / edit_community_post / delete_community_post |
POST | Full CRUD operations on community posts. |
toggle_post_reaction |
POST | Registers a like or dislike on a community post. |
toggle_offline |
POST | Adds/removes a song from offline cache database mapping. |
get_offline_ids |
GET | Fetches list of cached/offline song IDs mapped to the user. |
get_offline_songs |
GET | Fetches detailed metadata list of cached/offline songs. |
toggle_follow |
POST | Follows/unfollows a target user or artist. |
toggle_block |
POST | Blocks/unblocks a target user, preventing follows and direct messages. |
get_inbox / get_chat |
GET | Fetches conversation summaries and direct peer-to-peer message history. |
send_message / edit_message / delete_message |
POST | Handles sending (with image support), modifying, and deleting direct messages. |
toggle_collaborative |
POST | Toggles playlist collaborative state and deletes collaborators if made private. |
manage_collaborators |
POST | Adds, removes, or lists collaborators on a playlist. |
get_queue_songs |
POST | Fetches song metadata for a batch of IDs inside the dynamic play queue. |
get_radio_tracks |
GET | Generates 15 recommended tracks based on a seed song ID's genre/artist for Autoplay. |
update_favorite_order |
POST | Accepts an array of Song IDs to rewrite the sort_order column. |
update_offline_order |
POST | Accepts an array of Song IDs to rewrite position map of offline list. |
create_playlist |
POST | Generates a new playlist with a unique 8-byte hexadecimal public_id. |
copy_playlist |
POST | Clones another user's public playlist into the active user's account. |
unzip (Drive API) |
POST | Extracts a .zip archive directly on the server filesystem. Requires Admin session. |
properties (Drive API) |
GET | Calculates recursive byte sizes and structural counts (files/folders) for directories. |
get_versions / restore_version (Drive API) |
POST | Retrieves file snapshot history and restores files to past versions. Requires Admin session. |
terminal_cmd (Drive API) |
POST | Executes safe terminal commands (git, ls, pwd, php -v) on the server. Requires Admin session. |
export_playlist / export_favorites / export_offline |
GET | Generates a downloadable JSON representation of a playlist, favorites, or offline music list. |
import_playlist / import_favorites / import_offline |
POST | Parses an uploaded JSON file, matches DB files, and builds target playlist, favorites, or offline list. |
download_song |
GET | Downloads the specific song audio file as an attachment. |
get_stream |
GET | Streams the physical audio file with 206 Partial Content (HTTP Range) support. Handles offline stream cache reading. |
save_rhythm_score |
POST | Saves a user's raw score, maximum combo, and precise perfect/great/good hit metrics to the database. |
get_rhythm_leaderboard |
GET | Aggregates and returns the global player standings sorted by accumulated total scores. Limits to top 25 users. |
get_song_rhythm_leaderboard |
GET | Fetches top 25 high scores recorded specifically for a single song ID, flagging Full Combo achievements. |
toggle_rhythm_favorite |
POST | Toggles a song's favorite state inside the rhythm game ecosystem. |
get_rhythm_favorites |
GET | Retrieves the complete list of favorited rhythm game track IDs mapped to the user. |
upload_art |
POST | Uploads artwork images (single or multiple) with metadata, tags, series, and NSFW flag. Stores files in `phpshares/`. |
get_arts |
GET | Fetches a paginated list of artworks with filtering by type (image/manga), search, tags, characters, etc. |
get_art |
GET | Retrieves a single artwork with all its files, comments, and metadata. |
toggle_art_favorite |
POST | Adds/removes an artwork from the user's favorites. |
add_art_comment / edit_art_comment / delete_art_comment |
POST | CRUD operations on artwork comments with nested replies. |
get_arts_explore |
GET | Returns popular tags and trending artworks/manga for the explore page. |
get_series_details |
GET | Fetches a series with its aggregated metadata and list of works. |
save_imageditor_project |
POST | Saves an image editor project (title, dimensions, state JSON, category, starred) to the database. |
get_imageditor_projects |
GET | Lists the user's saved image editor projects with filtering and search. |
toggle_imageditor_star |
POST | Toggles starred status on an image editor project. |
delete_imageditor_project |
POST | Deletes a saved image editor project. |
inspect_audio |
POST | Uploads an audio file temporarily and returns its getID3 metadata (format, bitrate, duration, etc.) for the PHPAudio editor. |
save_audio_editor |
POST | Saves an edited audio file (including trimmed clip, metadata, cover art) to the library. Supports creating new or updating existing songs. |
get_song_versions / restore_song_version |
POST | Fetches version history for a song and restores a previous version. |
getid3/ directory exists and is accessible. Make sure PHP has read/write permissions for the local files and the project root (to create music.db). If using XAMPP/LAMPP, ensure SQLite extensions are activated in php.ini.
uploads/ directory is writable. Check your php.ini settings for upload_max_filesize and post_max_size and ensure they are large enough (e.g., 50M) to accommodate FLAC or WAV files. Also, verify your account is verified by the admin!
covers/songs and covers/albums directories.
[00:15.30] Lyric text instead of [00:15.30]Lyric text.
phpshares/ directory is writable and has proper permissions. Check that GD or ImageMagick is installed and enabled in PHP for image processing. Large images may time out; consider increasing memory_limit and max_execution_time in php.ini.