Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Spotify Web Api Php Laravel Package

jwilsson/spotify-web-api-php

View on GitHub
Deep Wiki
Context7

Managing a User's Playlists

There are lots of operations involving user's playlists that can be performed. Remember to request the correct scopes beforehand.

Listing a user's playlists

Note: This method is only available to extended quota apps.

$playlists = $api->getUserPlaylists('USER_ID', [
    'limit' => 5
]);

foreach ($playlists->items as $playlist) {
    echo '<a href="' . $playlist->external_urls->spotify . '">' . $playlist->name . '</a> <br>';
}

Getting info about a specific playlist

$playlist = $api->getPlaylist('PLAYLIST_ID');

echo $playlist->name;

Getting the image of a user's playlist

$playlistImage = $api->getPlaylistImage('PLAYLIST_ID');

Getting all items in a playlist

$playlistItems = $api->getPlaylistItems('PLAYLIST_ID');

foreach ($playlistItems->items as $item) {
    $item = $item->item;

    echo '<a href="' . $item->external_urls->spotify . '">' . $item->name . '</a> <br>';
}

Creating a new playlist

$api->createPlaylist('USER_ID', [
    'name' => 'My shiny playlist'
]);

Updating the details of a user's playlist

$api->updatePlaylist('PLAYLIST_ID', [
    'name' => 'New name'
]);

Updating the image of a user's playlist

$imageData = base64_encode(file_get_contents('image.jpg'));

$api->updatePlaylistImage('PLAYLIST_ID', $imageData);

Adding tracks to a user's playlist

$api->addPlaylistItems('PLAYLIST_ID', [
    'TRACK_URI',
    'EPISODE_URI'
]);

Delete items from a user's playlist

$items = [
    ['uri' => 'TRACK_URI'],
    ['uri' => 'EPISODE_URI'],
];

$api->deletePlaylistItems('PLAYLIST_ID', $tracks, 'SNAPSHOT_ID');

Updating the items in a playlist

$items = [
    'TRACK_URI',
    'EPISODE_URI'
];

$options = [
    'insert_before' => 10,
];

$api->updatePlaylistItems('PLAYLIST_ID', $items, $options, 'SNAPSHOT_ID');

Please see the method reference for more available options for each method.

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package