{"id":16541347,"url":"https://github.com/aerni/laravel-spotify","last_synced_at":"2025-04-04T09:09:49.434Z","repository":{"id":43374181,"uuid":"244674855","full_name":"aerni/laravel-spotify","owner":"aerni","description":"Spotify for Laravel is a simple wrapper around the Spotify Web API that makes working with its endpoints a breeze!","archived":false,"fork":false,"pushed_at":"2024-03-27T18:19:31.000Z","size":159,"stargazers_count":192,"open_issues_count":0,"forks_count":26,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-10-12T18:54:42.370Z","etag":null,"topics":["laravel","laravel-package","spotify","spotify-api","spotify-web-api","spotify-web-api-laravel"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/aerni.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-03T15:39:25.000Z","updated_at":"2024-09-27T11:51:22.000Z","dependencies_parsed_at":"2024-06-19T01:21:23.763Z","dependency_job_id":"f853cf6b-6f27-4358-8004-7ece3a8a1c6e","html_url":"https://github.com/aerni/laravel-spotify","commit_stats":{"total_commits":95,"total_committers":8,"mean_commits":11.875,"dds":"0.21052631578947367","last_synced_commit":"222a232b0b349eeac79c7b77e399efb7ebe42d88"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Flaravel-spotify","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Flaravel-spotify/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Flaravel-spotify/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/aerni%2Flaravel-spotify/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/aerni","download_url":"https://codeload.github.com/aerni/laravel-spotify/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247149502,"owners_count":20891954,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["laravel","laravel-package","spotify","spotify-api","spotify-web-api","spotify-web-api-laravel"],"created_at":"2024-10-11T18:54:44.912Z","updated_at":"2025-04-04T09:09:49.415Z","avatar_url":"https://github.com/aerni.png","language":"PHP","funding_links":["https://www.paypal.me/michaelaerni"],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n    \u003cimg src=\"https://github.com/aerni/laravel-spotify/blob/master/logo.png\" width=\"160\"\u003e\n    \u003cbr\u003e\n    Spotify for Laravel\n    \u003cbr\u003e\n\u003c/h1\u003e\n\u003ch4 align=\"center\"\u003eAn easy to use Spotify Web API wrapper for Laravel\u003c/h4\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://packagist.org/packages/aerni/laravel-spotify\"\u003e\n        \u003cimg src=\"https://flat.badgen.net/packagist/v/aerni/laravel-spotify\" alt=\"Packagist version\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://packagist.org/packages/aerni/laravel-spotify\"\u003e\n        \u003cimg src=\"https://flat.badgen.net/packagist/dt/aerni/laravel-spotify\" alt=\"Packagist total downloads\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/aerni/laravel-spotify/blob/master/LICENSE\"\u003e\n        \u003cimg src=\"https://flat.badgen.net/github/license/aerni/laravel-spotify\" alt=\"GitHub license\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://www.paypal.me/michaelaerni\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/PayPal-donate-blue.svg?style=flat-square\" alt=\"PayPal donate\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"#installation\"\u003eInstallation\u003c/a\u003e •\n    \u003ca href=\"#usage-example\"\u003eUsage Example\u003c/a\u003e •\n    \u003ca href=\"#optional-parameters\"\u003eOptional Parameters\u003c/a\u003e •\n    \u003ca href=\"#spotify-api-reference\"\u003eSpotify API Reference\u003c/a\u003e •\n    \u003cbr\u003e\n    \u003cbr\u003e\n\u003c/p\u003e\n\n## Introduction\nSpotify for Laravel makes working with the Spotify Web API a breeze. It provides straight forward methods for each endpoint and a fluent interface for optional parameters.\n\nThe package supports all Spotify Web API endpoints that are accessible with the [Client Credentials Flow](https://developer.spotify.com/documentation/general/guides/authorization-guide/#client-credentials-flow).\n\n## Installation\nInstall the package using Composer. The package will automatically register itself.\n\n```bash\ncomposer require aerni/laravel-spotify\n```\n\nPublish the config of the package.\n\n```bash\nphp artisan vendor:publish --provider=\"Aerni\\Spotify\\SpotifyServiceProvider\"\n```\n\nThe following config will be published to `config/spotify.php`.\n\n```php\nreturn [\n\n    /*\n    |--------------------------------------------------------------------------\n    | Authentication\n    |--------------------------------------------------------------------------\n    |\n    | The Client ID and Client Secret of your Spotify App.\n    |\n    */\n\n    'auth' =\u003e [\n        'client_id' =\u003e env('SPOTIFY_CLIENT_ID'),\n        'client_secret' =\u003e env('SPOTIFY_CLIENT_SECRET'),\n    ],\n\n    /*\n    |--------------------------------------------------------------------------\n    | Default Config\n    |--------------------------------------------------------------------------\n    |\n    | You may define a default country, locale and market that will be used\n    | for your Spotify API requests.\n    |\n    */\n\n    'default_config' =\u003e [\n        'country' =\u003e null,\n        'locale' =\u003e null,\n        'market' =\u003e null,\n    ],\n\n];\n```\n\nSet the `Client ID` and `Client Secret` of your [Spotify App](https://developer.spotify.com/dashboard) in your `.env` file.\n\n```env\nSPOTIFY_CLIENT_ID=********************************\nSPOTIFY_CLIENT_SECRET=********************************\n```\n\n## Usage Example\nImport the package at the top of your file. All of the following examples use the [Facade](https://laravel.com/docs/master/facades).\n\n```php\nuse Aerni\\Spotify\\Facades\\Spotify;\n```\n\nSearch for tracks with the name `Closed on Sunday`.\n\n```php\nSpotify::searchTracks('Closed on Sunday')-\u003eget();\n```\n\n**Important:** The `get()` method acts as the final method of the fluent interface. Make sure to always call it last in the method chain to execute a request to the Spotify Web API.\n\n## Optional Parameters\nYou may pass optional parameters to your requests using the fluent interface provided by this package. A common use case is to set a `limit` and `offset` to your request.\n\n```php\nSpotify::searchTracks('Closed on Sunday')-\u003elimit(50)-\u003eoffset(50)-\u003eget();\n```\n\n### Parameter Methods API Reference\nConsult the [Spotify Web API Reference Documentation](https://developer.spotify.com/documentation/web-api/reference/) to check which parameters are available to what endpoint.\n\n```php\n// Limit the response to a particular geographical market.\nSpotify::artistAlbums('artist_id')-\u003ecountry('US')-\u003eget();\n\n// Filter the query using the provided string.\nSpotify::playlist('playlist_id')-\u003efields('description, uri')-\u003eget();\n\n// Include any relevant content that is hosted externally.\nSpotify::searchTracks('query')-\u003eincludeExternal('audio')-\u003eget();\n\n// Filter the response using the provided string.\nSpotify::artistAlbums('artist_id')-\u003eincludeGroups('album, single, appears_on, compilation')-\u003eget();\n\n// Set the number of track objects to be returned.\nSpotify::searchTracks('query')-\u003elimit(10)-\u003eget();\n\n// Set the index of the first track to be returned.\nSpotify::searchTracks('query')-\u003eoffset(10)-\u003eget();\n\n// Limit the response to a particular geographical market.\nSpotify::searchAlbums('query')-\u003emarket('US')-\u003eget();\n\n// Limit the response to a particular language.\nSpotify::category('category_id')-\u003elocale('en_US')-\u003eget();\n```\n\n### Resetting Defaults\nYou may want to reset the default setting of `country`, `locale` or `market` for a given request. You may do so by calling the corresponding parameter method with an empty argument.\n\n```php\n// This will reset the default market to nothing.\nSpotify::searchTracks('query')-\u003emarket()-\u003eget();\n```\n\n### Response Key\nSome API responses are wrapped in a top level object like `artists` or `tracks`. If you want to directly access the content of a given top level object, you may do so by passing its key as a string to the `get()` method.\n\n```php\n// This will return the content of the tracks object.\nSpotify::searchTracks('query')-\u003eget('tracks');\n```\n\n## Spotify API Reference\n\n**Note:** Any parameter that accepts multiple values can either receive a string with comma-separated values or an array of values.\n\n```php\n// Pass a string with comma-separated values\nSpotify::albums('album_id, album_id_2, album_id_3')-\u003eget();\n\n// Or pass an array of values\nSpotify::albums(['album_id', 'album_id_2', 'album_id_3'])-\u003eget();\n```\n\n### Albums\n\n```php\n// Get an album by ID.\nSpotify::album('album_id')-\u003eget();\n\n// Get several albums by IDs. Provide a string or array of IDs.\nSpotify::albums('album_id, album_id_2, album_id_3')-\u003eget();\n\n// Get the tracks of an album by ID.\nSpotify::albumTracks('album_id')-\u003eget();\n```\n\n### Artists\n\n```php\n// Get an artist by ID.\nSpotify::artist('artist_id')-\u003eget();\n\n// Get several artists by IDs. Provide a string or array of IDs.\nSpotify::artists('artist_id, artist_id_2, artist_id_3')-\u003eget();\n\n// Get albums of an artist by ID.\nSpotify::artistAlbums('artist_id')-\u003eget();\n\n// Get the artist's top tracks by ID.\nSpotify::artistTopTracks('artist_id')-\u003eget();\n```\n\n### Browse\n\n```php\n// Get a category by ID.\nSpotify::category('category_id')-\u003eget();\n\n// Get a list of categories.\nSpotify::categories()-\u003eget();\n\n// Get a list of new releases.\nSpotify::newReleases()-\u003eget();\n```\n\n### Episodes\n\n```php\n// Get an episode by ID.\nSpotify::episode('episode_id')-\u003eget();\n\n// Get several episodes by IDs. Provide a string or array of IDs.\nSpotify::episodes('episode_id, episode_id_2, episode_id_3')-\u003eget();\n```\n\n### Playlists\n\n```php\n// Get a playlist by ID.\nSpotify::playlist('playlist_id')-\u003eget();\n\n// Get a playlist's tracks by ID.\nSpotify::playlistTracks('playlist_id')-\u003eget();\n\n// Get a playlist's cover image by ID.\nSpotify::playlistCoverImage('playlist_id')-\u003eget();\n```\n\n### Search\n\n```php\n// Search items by query. Provide a string or array to the second parameter.\nSpotify::searchItems('query', 'album, artist, playlist, track')-\u003eget();\n\n// Search albums by query.\nSpotify::searchAlbums('query')-\u003eget();\n\n// Search artists by query.\nSpotify::searchArtists('query')-\u003eget();\n\n// Search episodes by query.\nSpotify::searchEpisodes('query')-\u003eget();\n\n// Search playlists by query.\nSpotify::searchPlaylists('query')-\u003eget();\n\n// Search shows by query.\nSpotify::searchShows('query')-\u003eget();\n\n// Search tracks by query.\nSpotify::searchTracks('query')-\u003eget();\n```\n\n### Shows\n\n```php\n// Get a show by ID.\nSpotify::show('show_id')-\u003eget();\n\n// Get several shows by IDs. Provide a string or array of IDs.\nSpotify::shows('show_id, show_id_2, show_id_3')-\u003eget();\n\n// Get the episodes of a show by ID.\nSpotify::showEpisodes('show_id')-\u003eget();\n```\n\n### Tracks\n\n```php\n// Get a track by ID.\nSpotify::track('track_id')-\u003eget();\n\n// Get several tracks by IDs. Provide a string or array of IDs.\nSpotify::tracks('track_id, track_id_2, track_id_3')-\u003eget();\n```\n\n### User's Profile\n\n```php\n// Get a user's profile\nSpotify::user('user_id')-\u003eget();\n\n// Get a list of a user's playlists\nSpotify::userPlaylists('user_id')-\u003eget();\n```\n\n## Tests\nRun the tests like this:\n\n```bash\nvendor/bin/phpunit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerni%2Flaravel-spotify","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faerni%2Flaravel-spotify","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faerni%2Flaravel-spotify/lists"}