PHP code example of zhusaidong / php-music-api

1. Go to this page and download the library: Download zhusaidong/php-music-api library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

zhusaidong / php-music-api example snippets




use zhusaidong\phpMusicApi\MusicFactory;
use zhusaidong\phpMusicApi\MusicSite;

$musicApi = new MusicFactory(MusicSite::NetEaseYun);

$info = $musicApi->music(2188235);
var_dump($info);

MusicSite::Appecho
MusicSite::Kge
MusicSite::Kugou
MusicSite::Kuwo
MusicSite::Migu
MusicSite::NetEaseYun
MusicSite::Oneting
MusicSite::QQ
MusicSite::QianQian
MusicSite::Qingting
MusicSite::Taihe
MusicSite::Xiami
MusicSite::Ximalaya
MusicSite::Yinyuetai
MusicSite::Lizhi

$musicApi->music($id = '');//获取音乐
$musicApi->mv($id = '');//获取mv
$musicApi->playlist($id = '', bool $getSong = FALSE);//获取歌单