A PHP Composer package to get random anime, manga, and game recommendations Fully Random or by some filters
This Package is wrapper for bunch of my API's present at HishuAniGami
Install the package via Composer:
composer require burningyolo/get-random-recommendations<?php
require_once 'vendor/autoload.php';
use RandomRecommendations\RecommendationClient;
$client = new RecommendationClient();// Get a completely random anime
$anime = $client->getRandomAnime();
echo $anime->getTitle() . " - " . $anime->getMalUrl();
// Get anime with specific tags
$anime = $client->getRandomAnime(['action', 'adventure']);
echo "Anime: " . $anime->getTitle();
echo "Type: " . $anime->getType();
echo "Episodes: " . $anime->getEpisodes();
echo "Genres: " . implode(', ', $anime->getGenres());// Get a completely random manga
$manga = $client->getRandomManga();
echo $manga->getTitle() . " - " . $manga->getMalUrl();
// Get manga with specific tags
$manga = $client->getRandomManga(['romance', 'slice_of_life']);
echo "Manga: " . $manga->getTitle();
echo "Status: " . $manga->getStatus();
echo "Chapters: " . $manga->getChapters();
echo "Volumes: " . $manga->getVolumes();// Get a completely random game
$game = $client->getRandomGame();
echo $game->getName() . " - $" . $game->getPrice();
// Get game with specific filters
$game = $client->getRandomGame(
['Action', 'Adventure'], // genres
['Indie', 'Singleplayer'], // tags
29.99 // max price
);
echo "Game: " . $game->getName();
echo "Price: $" . $game->getPrice();
echo "Genres: " . implode(', ', $game->getGenres());
echo "Tags: " . implode(', ', $game->getTags());$recommendations = $client->getRandomRecommendations([
'anime_tags' => ['action', 'shounen'],
'manga_tags' => ['romance'],
'game_genres' => ['Indie'],
'game_tags' => ['Anime', 'cute'],
'max_price' => 10.00
]);
if ($recommendations['anime']) {
echo "Anime: " . $recommendations['anime']->getTitle() . "\n";
}
if ($recommendations['manga']) {
echo "Manga: " . $recommendations['manga']->getTitle() . "\n";
}
if ($recommendations['game']) {
echo "Game: " . $recommendations['game']->getName() . "\n";
}// Get all available anime tags
$animeTags = $client->getAnimeTags();
echo "Available anime tags: " . implode(', ', $animeTags);
// Get all available manga tags
$mangaTags = $client->getMangaTags();
echo "Available manga tags: " . implode(', ', $mangaTags);
// Get all available game tags
$gameTags = $client->getGameTags();
echo "Available game tags: " . implode(', ', $gameTags);
// Get all available game genres
$gameGenres = $client->getGameGenres();
echo "Available game genres: " . implode(', ', $gameGenres);use RandomRecommendations\Exceptions\ApiException;
try {
$anime = $client->getRandomAnime(['nonexistent_tag']);
} catch (ApiException $e) {
echo "Error: " . $e->getMessage();
}getTitle()- Get anime titlegetMalUrl()- Get MyAnimeList URLgetType()- Get anime type (TV, Movie, etc.)getEpisodes()- Get number of episodesgetGenres()- Get array of genrestoArray()- Get all data as array
getTitle()- Get manga titlegetMalUrl()- Get MyAnimeList URLgetStatus()- Get publication statusgetChapters()- Get number of chaptersgetVolumes()- Get number of volumesgetGenres()- Get array of genrestoArray()- Get all data as array
getName()- Get game namegetGameId()- Get game IDgetPrice()- Get game pricegetGenres()- Get array of genresgetTags()- Get array of tagstoArray()- Get all data as array
- PHP 8.1 or higher
- Guzzle HTTP client
MIT License