Looking to hire Laravel developers? Try LaraJobs

livetennisapi-laravel maintained by livetennisapi

Description
Laravel integration for the Live Tennis API — a facade, auto-discovered service provider and a server-rendered <x-tennis-scores /> Blade component over the official PHP client.
Author
Live Tennis API
Last update
2026/08/16 08:55 (dev-main)
License
Downloads
5

Comments
comments powered by Disqus

Live Tennis API — Laravel

Laravel integration for the Live Tennis API, wrapping the official PHP client: an auto-discovered service provider, a LiveTennis facade, and a server-rendered <x-tennis-scores /> Blade component.

Install

composer require livetennisapi/livetennisapi-laravel
php artisan vendor:publish --tag=livetennis-config

Set your key in .env:

LIVE_TENNIS_API_KEY=twjp_your_key_here

The service provider is auto-discovered (extra.laravel), so there is nothing to register manually.

Facade

use LiveTennisApi\Laravel\Facades\LiveTennis;

$live = LiveTennis::listMatches('live');
$player = LiveTennis::getPlayer(1218);
$fixtures = LiveTennis::listFixtures(tour: 'atp');

The facade proxies the configured LiveTennisApi singleton, so every client method and its return types (Page, TennisMatch, Player, Score, …) are available. See the PHP client README for the full method and error reference.

You can also type-hint the client directly anywhere the container resolves:

public function __construct(private \LiveTennisApi\LiveTennisApi $tennis) {}

Blade component

<x-tennis-scores />                                  {{-- config defaults --}}
<x-tennis-scores status="upcoming" :limit="5" tour="atp" />

Fetched and rendered server-side at render time. Any API or transport failure is caught and rendered as a graceful empty/error state — a live-scores widget never fatals the page. Publish and restyle the markup with:

php artisan vendor:publish --tag=livetennis-views

Attributes: status (live | upcoming | completed), limit, tour (atp | wta | challenger | itf | juniors). Omitted values fall back to config('livetennis.scores.*').

Configuration (config/livetennis.php)

Key Env Default
key LIVE_TENNIS_API_KEY
base_url LIVE_TENNIS_API_BASE_URL production base
auth_header LIVE_TENNIS_API_AUTH_HEADER bearer
timeout LIVE_TENNIS_API_TIMEOUT 30
max_retries LIVE_TENNIS_API_MAX_RETRIES 2
scores.status / scores.limit live / 10

Testing

composer install
vendor/bin/phpunit                       # offline, via orchestra/testbench
LIVETENNISAPI_KEY=twjp_… vendor/bin/phpunit --filter LiveSmokeTest   # live

Local development note

This repo's composer.json declares a path repository pointing at the sibling ../livetennisapi-php checkout for local development. Once both packages are published to Packagist, remove that repository entry and pin a normal version constraint (e.g. "livetennisapi/livetennisapi": "^1.0").

Requires

PHP 8.2+, Laravel 11 or 12.

License

MIT.