### Install Jikan PHP API Source: https://github.com/jikan-me/jikan/blob/master/readme.md Use Composer to install the Jikan PHP API. Ensure you are using a compatible PHP version. ```bash composer require jikan-me/jikan ^4 ``` -------------------------------- ### Install Jikan PHP Library Source: https://github.com/jikan-me/jikan/wiki/Home Use Composer to install the Jikan PHP library. This is the primary method for integrating Jikan into your PHP projects. ```bash composer require jikan-me/jikan ``` -------------------------------- ### Fetch Additional Info Source: https://context7.com/jikan-me/jikan/llms.txt Get the 'More Info' or additional notes section for a specific anime or manga. ```APIDOC ## getAnimeMoreInfo / getMangaMoreInfo — Fetch Additional Info Returns a nullable string with the "More Info" / additional notes field from a MAL anime or manga page. ### Example Usage ```php getAnimeMoreInfo(new AnimeMoreInfoRequest(1)); if ($moreInfo !== null) { echo $moreInfo . PHP_EOL; } $mangaMoreInfo = $jikan->getMangaMoreInfo(new MangaMoreInfoRequest(2)); echo $mangaMoreInfo ?? 'No additional info.' . PHP_EOL; ``` ``` -------------------------------- ### Fetch Additional Anime/Manga Info Source: https://context7.com/jikan-me/jikan/llms.txt Get the 'More Info' text field for a specific anime or manga. Returns null if no additional info is available. ```php getAnimeMoreInfo(new AnimeMoreInfoRequest(1)); if ($moreInfo !== null) { echo $moreInfo . PHP_EOL; } $mangaMoreInfo = $jikan->getMangaMoreInfo(new MangaMoreInfoRequest(2)); echo $mangaMoreInfo ?? 'No additional info.' . PHP_EOL; ``` -------------------------------- ### Fetch Anime/Manga by Producer or Magazine Source: https://context7.com/jikan-me/jikan/llms.txt Get a list of anime published by a specific producer or manga published by a magazine. Requires producer or magazine IDs. ```php getProducer(new ProducerRequest(18, 1)); echo $producer->getMeta()->getName() . PHP_EOL; // "Toei Animation" foreach ($producer->getAnime() as $anime) { echo $anime->getTitle() . PHP_EOL; } // Weekly Shounen Jump (magazine ID 83), page 1 $magazine = $jikan->getMagazine(new MagazineRequest(83, 1)); foreach ($magazine->getManga() as $manga) { echo $manga->getTitle() . PHP_EOL; } ``` -------------------------------- ### Fetch Recent or Popular Episodes Source: https://context7.com/jikan-me/jikan/llms.txt Get lists of recently aired or popular episodes from MAL's watch section. Requires pagination. ```php getRecentEpisodes(new RecentEpisodesRequest(1)); // page 1 foreach ($recent->getEpisodes() as $ep) { echo $ep->getAnime()->getName() . ' — Episode ' . $ep->getEpisodeNumber() . PHP_EOL; echo ' URL: ' . $ep->getUrl() . PHP_EOL; } $popular = $jikan->getPopularEpisodes(new PopularEpisodesRequest(1)); foreach ($popular->getEpisodes() as $ep) { echo $ep->getAnime()->getName() . PHP_EOL; } ``` -------------------------------- ### Fetch Watch Page Episodes Source: https://context7.com/jikan-me/jikan/llms.txt Get lists of recently aired or popular episodes from MyAnimeList's watch section, with pagination support. ```APIDOC ## getRecentEpisodes / getPopularEpisodes — Fetch Watch Page Episodes Returns `Model\Watch\Episodes` with recently aired or popular episodes listed on MAL's watch section. ### Example Usage ```php getRecentEpisodes(new RecentEpisodesRequest(1)); // page 1 foreach ($recent->getEpisodes() as $ep) { echo $ep->getAnime()->getName() . ' — Episode ' . $ep->getEpisodeNumber() . PHP_EOL; echo ' URL: ' . $ep->getUrl() . PHP_EOL; } $popular = $jikan->getPopularEpisodes(new PopularEpisodesRequest(1)); foreach ($popular->getEpisodes() as $ep) { echo $ep->getAnime()->getName() . PHP_EOL; } ``` ``` -------------------------------- ### Initialize MalClient Constructor Source: https://context7.com/jikan-me/jikan/llms.txt The MalClient is the entry point for all requests. It can be initialized with default settings or a custom HttpClientInterface for specific configurations like timeouts. ```php 10]); $jikan = new MalClient($httpClient); ``` -------------------------------- ### MalClient - Constructor Source: https://context7.com/jikan-me/jikan/llms.txt The MalClient class is the entry point for all requests. It can be instantiated with a default HTTP client or a custom one for specific configurations. ```APIDOC ## MalClient - Constructor The entry point for all requests. Accepts an optional `HttpClientInterface` for custom HTTP configuration (e.g., proxies, timeouts). When omitted, a default Symfony HttpClient instance is used. ```php 10]); $jikan = new MalClient($httpClient); ``` ``` -------------------------------- ### Run PHPUnit Tests Source: https://github.com/jikan-me/jikan/blob/master/readme.md Execute PHPUnit tests for the Jikan project using the provided command. ```bash php vendor/bin/phpunit ``` -------------------------------- ### Run GrumPHP Tests Source: https://github.com/jikan-me/jikan/blob/master/readme.md Execute GrumPHP, which includes PHPCS, PHPLint, and PHPUnit, using the provided command. ```bash php vendor/bin/grumphp run ``` -------------------------------- ### Error Handling with MalClient Source: https://context7.com/jikan-me/jikan/llms.txt Demonstrates how to catch `BadResponseException` for HTTP errors or invalid IDs, and `ParserException` for DOM parsing failures. Both exceptions include the failed request's path. ```php getAnime(new AnimeRequest(999999999)); } catch (BadResponseException $e) { // HTTP 404, invalid ID (0), or MAL "badresult" page echo 'HTTP/ID error: ' . $e->getMessage() . ' (code: ' . $e->getCode() . ')' . PHP_EOL; } catch (ParserException $e) { // DOM structure changed or parsing failed echo 'Parser error: ' . $e->getMessage() . PHP_EOL; } ``` -------------------------------- ### Fetch Anime Videos Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve promotional videos and episode video streams for a given anime ID. ```APIDOC ## getAnimeVideos — Fetch Anime Videos Returns a `Model\Anime\AnimeVideos` object with promo videos and episode video streams available on MAL. ### Example Usage ```php getAnimeVideos(new AnimeVideosRequest(1)); foreach ($videos->getPromos() as $promo) { echo $promo->getTitle() . PHP_EOL; echo ' YouTube ID: ' . $promo->getVideo()->getYoutubeId() . PHP_EOL; } foreach ($videos->getEpisodes() as $ep) { echo $ep->getTitle() . ' — ' . $ep->getUrl() . PHP_EOL; } ``` ``` -------------------------------- ### Fetch Anime Forum Topics Source: https://context7.com/jikan-me/jikan/llms.txt Fetches an array of forum topic objects related to a specific anime. Each topic contains details such as ID, title, author, and reply information. ```APIDOC ## getAnimeForum / getMangaForum — Fetch Forum Topics Returns an array of `Model\Forum\ForumTopic` objects for discussion threads related to an anime or manga. ```php getAnimeForum(new AnimeForumRequest(1)); foreach ($topics as $topic) { echo $topic->getTopicId() . ': ' . $topic->getTitle() . PHP_EOL; echo ' Author: ' . $topic->getAuthor()->getUsername() . PHP_EOL; echo ' Replies: ' . $topic->getReplies() . PHP_EOL; echo ' Last post: ' . $topic->getLastPostBy()->getUsername() . PHP_EOL; } ``` ``` -------------------------------- ### Fetch Anime Videos Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve promotional videos and episode video streams for a given anime ID. This includes YouTube links for promos. ```php getAnimeVideos(new AnimeVideosRequest(1)); foreach ($videos->getPromos() as $promo) { echo $promo->getTitle() . PHP_EOL; echo ' YouTube ID: ' . $promo->getVideo()->getYoutubeId() . PHP_EOL; } foreach ($videos->getEpisodes() as $ep) { echo $ep->getTitle() . ' — ' . $ep->getUrl() . PHP_EOL; } ``` -------------------------------- ### Fetch Anime Details by ID Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve comprehensive metadata for a single anime using its MAL ID. Handles potential BadResponseException for invalid IDs or 404 errors. ```php getAnime(new AnimeRequest(1)); // Cowboy Bebop (MAL ID: 1) echo $anime->getTitle(); // "Cowboy Bebop" echo $anime->getTitleEnglish(); // "Cowboy Bebop" echo $anime->getTitleJapanese(); // "カウボーイビバップ" echo $anime->getMalId(); // 1 echo $anime->getUrl(); // "https://myanimelist.net/anime/1/" echo $anime->getType(); // "TV" echo $anime->getEpisodes(); // 26 echo $anime->getStatus(); // "Finished Airing" echo (int)$anime->isAiring(); // 0 echo $anime->getScore(); // 8.75 echo $anime->getRank(); // (int rank) echo $anime->getPopularity(); // (int) echo $anime->getSynopsis(); // Full synopsis text // Air date range $aired = $anime->getAired(); echo $aired->getFrom()->format('Y-m-d'); // "1998-04-03" // Studios, producers, genres (MalUrl objects) foreach ($anime->getStudios() as $studio) { echo $studio->getName(); // "Sunrise" } foreach ($anime->getGenres() as $genre) { echo $genre->getName(); // "Action", "Sci-Fi", etc. } // All titles (preferred approach) foreach ($anime->getTitles() as $title) { echo $title->getType() . ': ' . $title->getTitle() . PHP_EOL; } } catch (BadResponseException $e) { echo '404 or invalid ID: ' . $e->getMessage(); } ``` -------------------------------- ### getAnimeEpisodes Source: https://context7.com/jikan-me/jikan/llms.txt Fetch a paginated list of episodes for a given anime. Episodes are returned 100 per page. Returns an empty model on a 404. ```APIDOC ## getAnimeEpisodes — Fetch Episode List ### Description Returns a `Model\Anime\Episodes` object containing a paginated list of `EpisodeListItem` objects. Episodes are paginated 100 per page. Returns an empty model (not an exception) when a 404 is encountered. ### Method ```php $episodes = $jikan->getAnimeEpisodes(new AnimeEpisodesRequest(20, 1)); ``` ### Parameters - **animeId**: (int) The MyAnimeList ID of the anime. - **page**: (int) The page number of the episode list to retrieve. ### Response Example ```php // Accessing episode data foreach ($episodes->getEpisodes() as $ep) { echo $ep->getEpisodeId() . ': ' . $ep->getTitle() . PHP_EOL; echo $ep->getTitleJapanese() . PHP_EOL; echo $ep->getAired() . PHP_EOL; // DateTimeImmutable|null echo (int)$ep->isFiller() . PHP_EOL; echo (int)$ep->isRecap() . PHP_EOL; } ``` ``` -------------------------------- ### Fetch by Producer or Magazine Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve details about a producer or magazine, including all anime or manga associated with them. Supports pagination. ```APIDOC ## getProducer / getMagazine — Fetch by Producer or Magazine Returns `Model\Producer\Producer` or `Model\Magazine\Magazine` with all anime/manga published by a given studio or magazine. ### Example Usage ```php getProducer(new ProducerRequest(18, 1)); echo $producer->getMeta()->getName() . PHP_EOL; // "Toei Animation" foreach ($producer->getAnime() as $anime) { echo $anime->getTitle() . PHP_EOL; } // Weekly Shounen Jump (magazine ID 83), page 1 $magazine = $jikan->getMagazine(new MagazineRequest(83, 1)); foreach ($magazine->getManga() as $manga) { echo $manga->getTitle() . PHP_EOL; } ``` ``` -------------------------------- ### Fetch Anime/Manga by Genre Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve paginated lists of anime or manga entries based on a specific genre ID. Use constants for genre IDs. ```APIDOC ## getAnimeGenre / getMangaGenre — Fetch Anime/Manga by Genre Returns `Model\Genre\AnimeGenre` or `Model\Genre\MangaGenre` with paginated anime/manga entries for a given genre ID. Use `Constants::GENRE_ANIME_*` or `Constants::GENRE_MANGA_*` for IDs. ### Example Usage ```php getAnimeGenre(new AnimeGenreRequest(Constants::GENRE_ANIME_ACTION, 1)); echo 'Genre: ' . $genre->getGenre()->getName() . PHP_EOL; echo 'Total: ' . $genre->getGenre()->getCount() . PHP_EOL; foreach ($genre->getAnime() as $item) { echo $item->getTitle() . ' — ' . $item->getScore() . PHP_EOL; } // Romance manga, page 2 $mangaGenre = $jikan->getMangaGenre(new MangaGenreRequest(Constants::GENRE_MANGA_ROMANCE, 2)); foreach ($mangaGenre->getManga() as $item) { echo $item->getTitle() . PHP_EOL; } ``` ``` -------------------------------- ### getAnime - Fetch Anime Details Source: https://context7.com/jikan-me/jikan/llms.txt Fetches comprehensive metadata for a single anime by its MAL ID, returning a Model\Anime\Anime object. ```APIDOC ## getAnime - Fetch Anime Details Returns a `Model\Anime\Anime` object with comprehensive metadata for a single anime by its MAL ID, including titles, synopsis, score, episodes, studios, genres, themes, streaming links, and related entries. ```php getAnime(new AnimeRequest(1)); // Cowboy Bebop (MAL ID: 1) echo $anime->getTitle(); // "Cowboy Bebop" echo $anime->getTitleEnglish(); // "Cowboy Bebop" echo $anime->getTitleJapanese(); // "カウボーイビバップ" echo $anime->getMalId(); // 1 echo $anime->getUrl(); // "https://myanimelist.net/anime/1/" echo $anime->getType(); // "TV" echo $anime->getEpisodes(); // 26 echo $anime->getStatus(); // "Finished Airing" echo (int)$anime->isAiring(); // 0 echo $anime->getScore(); // 8.75 echo $anime->getRank(); // (int rank) echo $anime->getPopularity(); // (int) echo $anime->getSynopsis(); // Full synopsis text // Air date range $aired = $anime->getAired(); echo $aired->getFrom()->format('Y-m-d'); // "1998-04-03" // Studios, producers, genres (MalUrl objects) foreach ($anime->getStudios() as $studio) { echo $studio->getName(); // "Sunrise" } foreach ($anime->getGenres() as $genre) { echo $genre->getName(); // "Action", "Sci-Fi", etc. } // All titles (preferred approach) foreach ($anime->getTitles() as $title) { echo $title->getType() . ': ' . $title->getTitle() . PHP_EOL; } } catch (BadResponseException $e) { echo '404 or invalid ID: ' . $e->getMessage(); } ``` ``` -------------------------------- ### getSchedule Source: https://context7.com/jikan-me/jikan/llms.txt Fetches the broadcast schedule for anime, grouped by day of the week. ```APIDOC ## getSchedule — Fetch Broadcast Schedule Returns a `Model\Schedule\Schedule` object with anime grouped by day of the week. ### Example Usage: ```php getSchedule(new ScheduleRequest()); foreach ($schedule->getMonday() as $anime) { echo $anime->getTitle() . PHP_EOL; } foreach ($schedule->getSunday() as $anime) { echo $anime->getTitle() . PHP_EOL; } // Days: getMonday, getTuesday, getWednesday, getThursday, getFriday, getSaturday, getSunday // Also: getOther() for irregular/unknown schedule ``` ``` -------------------------------- ### Fetch Season Archive Source: https://context7.com/jikan-me/jikan/llms.txt Retrieves a list of all available anime seasons. Useful for enumerating valid year/season combinations. Requires importing `MalClient` and `SeasonListRequest`. ```php getSeasonList(new SeasonListRequest()); foreach ($archive->getArchive() as $entry) { echo $entry->getYear() . ': '; echo implode(', ', $entry->getSeasons()) . PHP_EOL; // e.g. "2023: Winter, Spring, Summer, Fall" } ``` -------------------------------- ### getReviews Source: https://context7.com/jikan-me/jikan/llms.txt Fetches site-wide reviews for anime or manga. Supports filtering by type, sorting, and spoiler/preliminary options. ```APIDOC ## getReviews — Fetch Site-wide Reviews Returns `Model\Reviews\Reviews` with recent reviews across all anime or manga from the MAL reviews page. Supports sorting and spoiler/preliminary filters. ### Example Usage: ```php getReviews( new ReviewsRequest(Constants::ANIME, 1, Constants::REVIEWS_SORT_MOST_VOTED, true, true) ); foreach ($reviews->getReviews() as $review) { echo $review->getReviewer()->getUsername() . ' reviewed ' . PHP_EOL; echo ' Helpful: ' . $review->getHelpfulCount() . PHP_EOL; } // Newest manga reviews, no spoilers $mangaReviews = $jikan->getReviews( new ReviewsRequest(Constants::MANGA, 1, Constants::REVIEWS_SORT_NEWEST, false, false) ); ``` ``` -------------------------------- ### Fetch Manga Details by ID Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve metadata for a single manga using its MAL ID. Returns null for volumes and chapters if the manga is ongoing. ```php getManga(new MangaRequest(2)); // Berserk (MAL ID: 2) echo $manga->getTitle(); // "Berserk" echo $manga->getType(); // "Manga" echo $manga->getVolumes(); // null if ongoing echo $manga->getChapters(); // null if ongoing echo $manga->getStatus(); // "Publishing" echo $manga->getScore(); // 9.44 echo $manga->getSynopsis(); foreach ($manga->getAuthors() as $author) { echo $author->getName(); // "Miura, Kentarou" } foreach ($manga->getGenres() as $genre) { echo $genre->getName(); } ``` -------------------------------- ### Fetch Recent Recommendations Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve recently posted anime or manga recommendations from users on MyAnimeList, with pagination. ```APIDOC ## getRecentRecommendations — Fetch Recent Recommendations Returns `Model\Recommendations\RecentRecommendations` with recently posted anime or manga recommendations from users. ### Example Usage ```php getRecentRecommendations( new RecentRecommendationsRequest(Constants::RECENT_RECOMMENDATION_ANIME, 1) ); foreach ($recs->getRecommendations() as $rec) { $entries = $rec->getEntries(); echo $entries[0]->getName() . ' → ' . $entries[1]->getName() . PHP_EOL; echo ' By: ' . $rec->getUser()->getUsername() . PHP_EOL; echo ' ' . substr($rec->getContent(), 0, 150) . PHP_EOL; } ``` ``` -------------------------------- ### Fetch Recent Recommendations Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve recent anime or manga recommendations posted by users. Specify whether to fetch anime or manga recommendations. ```php getRecentRecommendations( new RecentRecommendationsRequest(Constants::RECENT_RECOMMENDATION_ANIME, 1) ); foreach ($recs->getRecommendations() as $rec) { $entries = $rec->getEntries(); echo $entries[0]->getName() . ' → ' . $entries[1]->getName() . PHP_EOL; echo ' By: ' . $rec->getUser()->getUsername() . PHP_EOL; echo ' ' . substr($rec->getContent(), 0, 150) . PHP_EOL; } ``` -------------------------------- ### Error Handling Source: https://context7.com/jikan-me/jikan/llms.txt Details on how to handle exceptions thrown by the MalClient, including `BadResponseException` for HTTP errors or invalid IDs, and `ParserException` for DOM parsing failures. ```APIDOC ## Error Handling All `MalClient` methods throw `BadResponseException` for HTTP errors and invalid IDs, and `ParserException` for DOM parsing failures. Both carry the failed request's path for debugging. ```php getAnime(new AnimeRequest(999999999)); } catch (BadResponseException $e) { // HTTP 404, invalid ID (0), or MAL "badresult" page echo 'HTTP/ID error: ' . $e->getMessage() . ' (code: ' . $e->getCode() . ')' . PHP_EOL; } catch (ParserException $e) { // DOM structure changed or parsing failed echo 'Parser error: ' . $e->getMessage() . PHP_EOL; } ``` ``` -------------------------------- ### Fetch Character Details Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve detailed information about a specific character, including biography, voice actors, and anime/manga appearances. Handles potential 'BadResponseException' for invalid IDs. ```php getCharacter(new CharacterRequest(1)); // Spike Spiegel echo $char->getName() . PHP_EOL; echo $char->getNameKanji() . PHP_EOL; echo $char->getAbout() . PHP_EOL; foreach ($char->getAnimeography() as $entry) { echo $entry->getAnime()->getName() . ' (' . $entry->getRole() . ')' . PHP_EOL; } foreach ($char->getVoiceActors() as $va) { echo $va->getPerson()->getName() . ' [' . $va->getLanguage() . ']' . PHP_EOL; } } catch (BadResponseException $e) { // Thrown for ID 0 or MAL "Invalid ID provided" pages echo 'Character not found: ' . $e->getMessage(); } ``` -------------------------------- ### Fetch Anime Forum Topics Source: https://context7.com/jikan-me/jikan/llms.txt Fetches discussion threads for a given anime ID. Requires importing `MalClient`, `AnimeForumRequest`. Iterates through results to display topic ID, title, author, replies, and last post information. ```php getAnimeForum(new AnimeForumRequest(1)); foreach ($topics as $topic) { echo $topic->getTopicId() . ': ' . $topic->getTitle() . PHP_EOL; echo ' Author: ' . $topic->getAuthor()->getUsername() . PHP_EOL; echo ' Replies: ' . $topic->getReplies() . PHP_EOL; echo ' Last post: ' . $topic->getLastPostBy()->getUsername() . PHP_EOL; } ``` -------------------------------- ### Fetch Anime/Manga by Genre Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve paginated anime or manga entries for a specific genre ID. Use constants like Constants::GENRE_ANIME_ACTION or Constants::GENRE_MANGA_ROMANCE for genre IDs. ```php getAnimeGenre(new AnimeGenreRequest(Constants::GENRE_ANIME_ACTION, 1)); echo 'Genre: ' . $genre->getGenre()->getName() . PHP_EOL; echo 'Total: ' . $genre->getGenre()->getCount() . PHP_EOL; foreach ($genre->getAnime() as $item) { echo $item->getTitle() . ' — ' . $item->getScore() . PHP_EOL; } // Romance manga, page 2 $mangaGenre = $jikan->getMangaGenre(new MangaGenreRequest(Constants::GENRE_MANGA_ROMANCE, 2)); foreach ($mangaGenre->getManga() as $item) { echo $item->getTitle() . PHP_EOL; } ``` -------------------------------- ### Fetch Anime Reviews Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve paginated community reviews for a specific anime, including reviewer metadata and scores. Supports specifying the page number. ```php getAnimeReviews(new AnimeReviewsRequest(1, 1)); // page 1 foreach ($reviews->getReviews() as $review) { echo $review->getReviewer()->getUsername() . PHP_EOL; echo ' Episodes seen: ' . $review->getReviewer()->getEpisodesSeen() . PHP_EOL; echo ' Scores: ' . implode(', ', (array)$review->getScores()) . PHP_EOL; echo ' ' . substr($review->getContent(), 0, 200) . '...' . PHP_EOL; } ``` -------------------------------- ### Fetch Anime Characters and Staff - Jikan API Source: https://context7.com/jikan-me/jikan/llms.txt Fetches all characters (with voice actors) and staff members for a specific anime ID. Useful for understanding the production and cast of an anime. ```php getAnimeCharactersAndStaff(new AnimeCharactersAndStaffRequest(1)); foreach ($data->getCharacters() as $character) { echo $character->getCharacter()->getName() . ' (' . $character->getRole() . ')' . PHP_EOL; foreach ($character->getVoiceActors() as $va) { echo ' VA: ' . $va->getPerson()->getName() . ' [' . $va->getLanguage() . ']' . PHP_EOL; } } foreach ($data->getStaff() as $staff) { echo $staff->getPerson()->getName() . ': '; echo implode(', ', $staff->getPositions()) . PHP_EOL; } ``` -------------------------------- ### Fetch Anime Episodes - Jikan API Source: https://context7.com/jikan-me/jikan/llms.txt Retrieves a paginated list of episodes for a given anime ID. Handles 404s by returning an empty model. Episodes are paginated 100 per page. ```php getAnimeEpisodes(new AnimeEpisodesRequest(20, 1)); foreach ($episodes->getEpisodes() as $ep) { echo $ep->getEpisodeId() . ': ' . $ep->getTitle() . PHP_EOL; // e.g. "1: Enter! Naruto Uzumaki!" echo $ep->getTitleJapanese() . PHP_EOL; echo $ep->getAired() . PHP_EOL; // DateTimeImmutable|null echo (int)$ep->isFiller() . PHP_EOL; echo (int)$ep->isRecap() . PHP_EOL; } ``` -------------------------------- ### getAnimeReviews / getMangaReviews Source: https://context7.com/jikan-me/jikan/llms.txt Fetches paginated community reviews for a specific anime or manga. Includes reviewer metadata and scores. ```APIDOC ## getAnimeReviews / getMangaReviews — Fetch Item Reviews Returns `Model\Anime\AnimeReviews` or `Model\Manga\MangaReviews` with paginated community reviews including reviewer metadata and scores. ### Example Usage: ```php getAnimeReviews(new AnimeReviewsRequest(1, 1)); // page 1 foreach ($reviews->getReviews() as $review) { echo $review->getReviewer()->getUsername() . PHP_EOL; echo ' Episodes seen: ' . $review->getReviewer()->getEpisodesSeen() . PHP_EOL; echo ' Scores: ' . implode(', ', (array)$review->getScores()) . PHP_EOL; echo ' ' . substr($review->getContent(), 0, 200) . '...' . PHP_EOL; } ``` ``` -------------------------------- ### Fetch User Anime/Manga Lists Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve a user's anime or manga list, supporting filtering by status and ordering. Uses MAL's internal JSON endpoint with 300 items per page. ```php getUserAnimeList( new UserAnimeListRequest('Nekomata1037', 1, Constants::USER_ANIME_LIST_ALL) ); foreach ($animeList as $item) { echo $item->getAnimeTitle() . ' — Status: ' . $item->getStatus() . PHP_EOL; echo ' Score: ' . $item->getScore() . ', Progress: ' . $item->getWatchedEpisodes() . PHP_EOL; } // Only watching, sorted by score descending $request = new UserAnimeListRequest('Nekomata1037', 1, Constants::USER_ANIME_LIST_WATCHING); $request->setOrderBy(Constants::USER_ANIME_LIST_ORDER_BY_SCORE, Constants::USER_LIST_SORT_DESCENDING); $watchingList = $jikan->getUserAnimeList($request); // Manga list — completed only $mangaList = $jikan->getUserMangaList( new UserMangaListRequest('Nekomata1037', 1, Constants::USER_MANGA_LIST_COMPLETED) ); foreach ($mangaList as $item) { echo $item->getMangaTitle() . PHP_EOL; } ``` -------------------------------- ### Fetch Manga Forum Topics Source: https://context7.com/jikan-me/jikan/llms.txt Fetches discussion threads for a given manga ID. Requires importing `MalClient`, `MangaForumRequest`. Iterates through results to display topic ID, title, author, replies, and last post information. ```php getMangaForum(new MangaForumRequest(1)); foreach ($topics as $topic) { echo $topic->getTopicId() . ': ' . $topic->getTitle() . PHP_EOL; echo ' Author: ' . $topic->getAuthor()->getUsername() . PHP_EOL; echo ' Replies: ' . $topic->getReplies() . PHP_EOL; echo ' Last post: ' . $topic->getLastPostBy()->getUsername() . PHP_EOL; } ``` -------------------------------- ### Fetch Anime/Manga Community Statistics Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve community statistics for a specific anime or manga, including user counts for different statuses (watching, completed, etc.) and score distributions. ```php getAnimeStats(new AnimeStatsRequest(1)); echo 'Watching: ' . $stats->getWatching() . PHP_EOL; echo 'Completed: ' . $stats->getCompleted() . PHP_EOL; echo 'On Hold: ' . $stats->getOnHold() . PHP_EOL; echo 'Dropped: ' . $stats->getDropped() . PHP_EOL; echo 'Plan to Watch: ' . $stats->getPlanToWatch() . PHP_EOL; echo 'Total: ' . $stats->getTotal() . PHP_EOL; // Score distribution foreach ($stats->getScores() as $score) { echo 'Score ' . $score->getScore() . ': ' . $score->getVotes() . ' votes (' . $score->getPercentage() . '%)' . PHP_EOL; } $mangaStats = $jikan->getMangaStats(new MangaStatsRequest(2)); echo 'Reading: ' . $mangaStats->getReading() . PHP_EOL; ``` -------------------------------- ### Fetch Person (Voice Actor/Staff) Details Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve details for a person (voice actor or staff member) on MyAnimeList, including biography and their roles in anime. Requires instantiation of MalClient and PersonRequest. ```php getPerson(new PersonRequest(1)); // Tomokazu Seki echo $person->getName() . PHP_EOL; echo $person->getGivenName() . ' ' . $person->getFamilyName() . PHP_EOL; echo $person->getBirthday()->format('Y-m-d') . PHP_EOL; echo $person->getMore() . PHP_EOL; foreach ($person->getVoiceActingRoles() as $role) { echo $role->getAnime()->getName() . ' — ' . $role->getCharacter()->getName() . PHP_EOL; } foreach ($person->getAnimeStaffPositions() as $position) { echo $position->getAnime()->getName() . ': ' . implode(', ', $position->getPositions()) . PHP_EOL; } ``` -------------------------------- ### getTopAnime / getTopManga Source: https://context7.com/jikan-me/jikan/llms.txt Fetches paginated top-ranked anime or manga entries. Supports filtering by subtype for anime. ```APIDOC ## getTopAnime / getTopManga — Fetch Top Rankings Returns `Model\Top\TopAnime` or `Model\Top\TopManga` with paginated top-ranked entries (50 per page). Supports filtering by subtype. ### Example Usage: ```php getTopAnime(new TopAnimeRequest(1)); foreach ($topAnime->getTop() as $item) { echo '#' . $item->getRank() . ' ' . $item->getTitle() . ' (Score: ' . $item->getScore() . ')' . PHP_EOL; } // Top airing anime $topAiring = $jikan->getTopAnime(new TopAnimeRequest(1, Constants::TOP_AIRING)); // Top movies $topMovies = $jikan->getTopAnime(new TopAnimeRequest(1, Constants::TOP_MOVIE)); // Top manga, page 2 $topManga = $jikan->getTopManga(new TopMangaRequest(2)); foreach ($topManga->getTop() as $item) { echo '#' . $item->getRank() . ' ' . $item->getTitle() . PHP_EOL; } ``` ``` -------------------------------- ### getManga - Fetch Manga Details Source: https://context7.com/jikan-me/jikan/llms.txt Fetches metadata for a single manga by MAL ID, returning a Model\Manga\Manga object. ```APIDOC ## getManga - Fetch Manga Details Returns a `Model\Manga\Manga` object containing metadata for a single manga by MAL ID, including volumes, chapters, serializations, authors, and status. ```php getManga(new MangaRequest(2)); // Berserk (MAL ID: 2) echo $manga->getTitle(); // "Berserk" echo $manga->getType(); // "Manga" echo $manga->getVolumes(); // null if ongoing echo $manga->getChapters(); // null if ongoing echo $manga->getStatus(); // "Publishing" echo $manga->getScore(); // 9.44 echo $manga->getSynopsis(); foreach ($manga->getAuthors() as $author) { echo $author->getName(); // "Miura, Kentarou" } foreach ($manga->getGenres() as $genre) { echo $genre->getName(); } ``` ``` -------------------------------- ### Fetch Broadcast Schedule Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve the anime broadcast schedule grouped by day of the week. Uses the ScheduleRequest object. Includes methods for each day and an 'other' category. ```php getSchedule(new ScheduleRequest()); foreach ($schedule->getMonday() as $anime) { echo $anime->getTitle() . PHP_EOL; } foreach ($schedule->getSunday() as $anime) { echo $anime->getTitle() . PHP_EOL; } // Days: getMonday, getTuesday, getWednesday, getThursday, getFriday, getSaturday, getSunday // Also: getOther() for irregular/unknown schedule ``` -------------------------------- ### Fetch Top Anime and Manga Rankings Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve paginated lists of top-ranked anime or manga. Supports filtering by subtype for anime. Requires instantiation of MalClient and appropriate request objects. ```php getTopAnime(new TopAnimeRequest(1)); foreach ($topAnime->getTop() as $item) { echo '#' . $item->getRank() . ' ' . $item->getTitle() . ' (Score: ' . $item->getScore() . ')' . PHP_EOL; } // Top airing anime $topAiring = $jikan->getTopAnime(new TopAnimeRequest(1, Constants::TOP_AIRING)); // Top movies $topMovies = $jikan->getTopAnime(new TopAnimeRequest(1, Constants::TOP_MOVIE)); // Top manga, page 2 $topManga = $jikan->getTopManga(new TopMangaRequest(2)); foreach ($topManga->getTop() as $item) { echo '#' . $item->getRank() . ' ' . $item->getTitle() . PHP_EOL; } ``` -------------------------------- ### Fetch Site-wide Reviews Source: https://context7.com/jikan-me/jikan/llms.txt Retrieve recent reviews across all anime or manga from the MAL reviews page. Supports filtering by type, page, sort order, and spoiler/preliminary content. ```php getReviews( new ReviewsRequest(Constants::ANIME, 1, Constants::REVIEWS_SORT_MOST_VOTED, true, true) ); foreach ($reviews->getReviews() as $review) { echo $review->getReviewer()->getUsername() . ' reviewed ' . PHP_EOL; echo ' Helpful: ' . $review->getHelpfulCount() . PHP_EOL; } // Newest manga reviews, no spoilers $mangaReviews = $jikan->getReviews( new ReviewsRequest(Constants::MANGA, 1, Constants::REVIEWS_SORT_NEWEST, false, false) ); ```