Download the PHP package bjthecod3r/laravel-tmdb without Composer
On this page you can find all versions of the php package bjthecod3r/laravel-tmdb. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bjthecod3r/laravel-tmdb
More information about bjthecod3r/laravel-tmdb
Files in bjthecod3r/laravel-tmdb
Package laravel-tmdb
Short Description A fluent, fully-typed Laravel wrapper for The Movie Database (TMDB) API.
License MIT
Homepage https://github.com/BJTheCod3r/laravel-tmdb
Informations about the package laravel-tmdb
Laravel TMDB
A fluent, fully-typed Laravel wrapper for The Movie Database (TMDB) API.
Supports Laravel 11, 12 and 13 on PHP 8.2+.
Installation
Publish the config file (optional):
Configuration
Add your credentials to .env. The package prefers the v4 Read Access Token
(sent as a Bearer header); if it is absent it falls back to the classic v3
API key (sent as an api_key query parameter).
You can find both credentials under Settings → API in your TMDB account.
Usage
The Tmdb facade exposes one accessor per endpoint group. Calls return typed
Paginated
wrapper. Every method accepts an optional $params array for extra TMDB query
parameters (page, append_to_response, region, …).
Movies
TV
People
Search
Search and discover requests send the configured TMDB_INCLUDE_ADULT default
as include_adult; pass ['include_adult' => 'true'] to override per call.
Discover
discover() returns a fluent builder; call get() to execute.
Trending
Genres & Configuration
Resources
Endpoint methods return typed objects (Movie, TvShow, Person, …) with
documented properties — your IDE autocompletes them and dates come back as
CarbonImmutable instances:
Every resource also keeps the raw TMDB payload. Any field — even one not mapped
to a typed property — is reachable via property access, array access, get()
(dot notation supported), and toArray() / jsonSerialize():
Pagination
List endpoints return a Paginated wrapper that is iterable and JSON-serializable:
Image URLs
TMDB resources expose relative image paths. Build absolute URLs with the
image() helper (sizes come from Tmdb::configuration()->details()):
The CDN root defaults to https://image.tmdb.org/t/p/ and can be changed via
TMDB_IMAGE_BASE_URL (config key image_base_url).
Error handling
Failed requests throw typed exceptions, all extending TmdbException:
| Exception | When |
|---|---|
AuthenticationException |
401 — invalid/missing credentials |
ResourceNotFoundException |
404 — unknown resource |
ValidationException |
400 / 422 — invalid request |
RateLimitException |
429 — exposes ->retryAfter (seconds) |
ApiException |
connection errors and unexpected 5xx |
If neither credential is configured, an AuthenticationException is thrown
before any request is sent.
Rate-limit (429) and 5xx responses to GET requests are retried automatically
per the retry config before the exception is thrown, honouring the TMDB
Retry-After header when present. Write requests (POST/DELETE) are never
retried, since they are not idempotent.
Dependency injection
The facade is convenient, but you can also type-hint the manager or the underlying client:
An escape hatch for endpoints not yet wrapped:
Testing
Because the client is built on Laravel's Http facade, you can fake TMDB in
your own app's tests:
The package's own suite:
License
The MIT License (MIT). See LICENSE.md.
All versions of laravel-tmdb with dependencies
illuminate/contracts Version ^11.0 || ^12.0 || ^13.0
illuminate/http Version ^11.0 || ^12.0 || ^13.0
illuminate/support Version ^11.0 || ^12.0 || ^13.0
nesbot/carbon Version ^2.72 || ^3.0