Im trying to use google/apiclient 2.0 in php. This is I got so far:
require 'vendor/autoload.php';
use Google\Client;
use Google\Service\YouTube;
$client = new Client();
$client->setAuthConfig('client_secret_apps.googleusercontent.com.json');
$youtube = new Google\Service\YouTube($client);
var_dump($youtube->playlistItems->listPlaylistItems(
'snippet', ['playlistId' => 'PLDxxxxxxxxxxxxxx']
));
and I get this fatal error:
PHP Fatal error: Uncaught TypeError: implode(): Argument #2 ($array)
must be of type ?array, string given in
vendor\google\apiclient\src\Google\Service\Resource.php:291
Stack
trace:
#0 vendor\google\apiclient\src\Google\Service\Resource.php(291): implode(Array, ‘&’)
#1 vendor\google\apiclient\src\Google\Service\Resource.php(189): Google_Service_Resource->createRequestUri(‘youtube/v3/play…’, Array)
#2 vendor\google\apiclient-services\src\YouTube\Resource\PlaylistItems.php(127):
Google_Service_Resource->call(‘list’, Array, ‘Google\Service\…’)
#3 upload.php(112): Google\Service\YouTube\Resource\PlaylistItems->listPlaylistItems(‘snippet’,
Array)
#4 {main} thrown in vendor\google\apiclient\src\Google\Service\Resource.php on line 291