burningyolo / get-random-recommendations
A PHP package to get random anime, manga, and game recommendations
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/burningyolo/get-random-recommendations
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^10.0
README
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
Installation
Install the package via Composer:
composer require burningyolo/get-random-recommendations
Usage
Basic Setup
<?php require_once 'vendor/autoload.php'; use RandomRecommendations\RecommendationClient; $client = new RecommendationClient();
Getting Random Recommendations
Random Anime
// 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());
Random Manga
// 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();
Random Game
// 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());
Get All Random Recommendations at Once
$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"; }
Getting Available Tags/Genres
// 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);
Error Handling
use RandomRecommendations\Exceptions\ApiException; try { $anime = $client->getRandomAnime(['nonexistent_tag']); } catch (ApiException $e) { echo "Error: " . $e->getMessage(); }
Models
Anime Model
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
Manga Model
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
Game Model
getName()- Get game namegetGameId()- Get game IDgetPrice()- Get game pricegetGenres()- Get array of genresgetTags()- Get array of tagstoArray()- Get all data as array
Requirements
- PHP 8.1 or higher
- Guzzle HTTP client
License
MIT License