PHP code example of aalfiann / myanimelist-api-php

1. Go to this page and download the library: Download aalfiann/myanimelist-api-php 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/ */

    

aalfiann / myanimelist-api-php example snippets



aalfiann\MyAnimeList;

/**
 * Build object and set parameter
 * 
 * @property pretty = Output data json will be beautifier. Type data is boolean, default value is false. 
 * @property proxy = Create connection using proxy. Default value is null.
 * @property proxyauth = Your credentials to use the proxy. Default value is null.
 */
$getMAL = new MyAnimeList;
$getMAL->pretty = true;

/**
 * Example to search Anime 
 */
echo $getMAL->findAnime('overlord',true); //Set false to get data detail directly.

/**
 * Example to search Manga
 */
echo $getMAL->findManga('naruto',true); //Set false to get data detail directly.

/**
 * Example to get Anime by ID
 * Data will return 1, very accurate
 */
echo $getMAL->grabAnime('2886');

/**
 * Example to get Manga by ID
 * Data will return 1, very accurate
 */
echo $getMAL->grabManga('21');



aalfiann\MyAnimeList;

/**
 * Build object and set parameter
 * 
 * @property login = Your login in MyAnimeList. (Required)
 * @property pretty = Output data json will be beautifier. Type data is boolean, default value is false. 
 * @property proxy = Create connection using proxy. Default value is null.
 * @property proxyauth = Your credentials to use the proxy. Default value is null.
 */
$getMAL = new MyAnimeList;
$getMAL->login = 'yourusername:yourpassword';
$getMAL->pretty = true;

/**
 * Example to search Anime
 */
echo $getMAL->searchAnime('full metal',true); //Set false to get data detail directly.

/**
 * Example to search Manga
 */
echo $getMAL->searchManga('full metal',true); //Set false to get data detail directly.

/**
 * Example to get Anime
 * Data will return 1, accuracy will depend on the title
 */
echo $getMAL->searchAnime('full metal');

/**
 * Example to get Manga
 * Data will return 1, accuracy will depend on the title
 */
echo $getMAL->searchManga('full metal');

/**
 * Example to verify credentials in MyAnimeList
 */
echo $getMAL->verify();


composer