PHP Integration

YouTube Transcript API for PHP

Integrate YouTube transcript extraction into your PHP applications using cURL or Guzzle. Our API is perfect for WordPress plugins, Laravel applications, and any PHP backend that needs access to YouTube captions and subtitles.

Install Dependencies

composer require guzzlehttp/guzzle

Complete Code Example

<?php
require 'vendor/autoload.php';

use GuzzleHttp\Client;

$client = new Client();
$apiKey = getenv('YT_TRANSCRIPTS_API_KEY');

$response = $client->get('https://api.youtubetranscripts.co/v1/transcript', [
    'query' => [
        'url' => 'https://www.youtube.com/watch?v=dQw4w9WgXcQ',
    ],
    'headers' => [
        'x-api-key' => $apiKey,
    ],
]);

$data = json_decode($response->getBody(), true);

echo "Title: " . $data['title'] . "\n";
echo "Channel: " . $data['channel'] . "\n";

foreach ($data['transcript'] as $segment) {
    printf("[%.1fs] %s\n", $segment['start'], $segment['text']);
}

Key Features for PHP Developers

Works with Guzzle, cURL, and native file_get_contents

Perfect for WordPress plugins and Laravel apps

JSON response decodes directly to PHP arrays

Compatible with PHP 7.4+ and PHP 8.x

Batch endpoint for bulk video processing

Lightweight integration with no SDK required

Start Building with PHP Today

Sign up in 30 seconds. Get 150 free API requests. No credit card required. Your PHP integration can be live in minutes.