PHPackages                             calliostro/spotify-web-api-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. calliostro/spotify-web-api-bundle

ActiveSymfony-bundle[Image &amp; Media](/categories/media)

calliostro/spotify-web-api-bundle
=================================

Symfony bundle for the Spotify Web API — streaming, music data &amp; integration made easy

v1.3.0(4mo ago)121.9k↓25%3MITPHPPHP ^8.1CI passing

Since Apr 18Pushed 4mo ago1 watchersCompare

[ Source](https://github.com/calliostro/spotify-web-api-bundle)[ Packagist](https://packagist.org/packages/calliostro/spotify-web-api-bundle)[ Docs](https://github.com/calliostro/spotify-web-api-bundle)[ RSS](/packages/calliostro-spotify-web-api-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (9)Dependencies (5)Versions (10)Used By (0)

🎵 Spotify Web API Bundle
========================

[](#-spotify-web-api-bundle)

[![CI](https://github.com/calliostro/spotify-web-api-bundle/workflows/CI/badge.svg)](https://github.com/calliostro/spotify-web-api-bundle/actions)[![Version](https://camo.githubusercontent.com/6e47c412fa30771112f0aefb34ad031a9a62f31a3d102f1d4a4aa458ba41c5a0/68747470733a2f2f706f7365722e707567782e6f72672f63616c6c696f7374726f2f73706f746966792d7765622d6170692d62756e646c652f76657273696f6e)](https://packagist.org/packages/calliostro/spotify-web-api-bundle)[![License](https://camo.githubusercontent.com/de83ab924c2ca8b3a4ef154131ba100e13d1fd7002f2b6824ebbe8c62ffc3ac8/68747470733a2f2f706f7365722e707567782e6f72672f63616c6c696f7374726f2f73706f746966792d7765622d6170692d62756e646c652f6c6963656e7365)](https://packagist.org/packages/calliostro/spotify-web-api-bundle)

> 🚀 **Easy integration of [jwilsson/spotify-web-api-php](https://github.com/jwilsson/spotify-web-api-php) into Symfony 6.4, 7 &amp; 8!**

✨ Features
----------

[](#-features)

- Simple integration with Symfony 6.4, 7 &amp; 8
- Supports [jwilsson/spotify-web-api-php](https://github.com/jwilsson/spotify-web-api-php) v6 &amp; v7
- Supports Client Credentials &amp; Authorization Code flows
- Autowire Spotify API services
- Customizable token provider
- Easy configuration

📦 Installation
--------------

[](#-installation)

Make sure Composer is installed globally, as explained in the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.

### ⚡ Applications that use Symfony Flex

[](#-applications-that-use-symfony-flex)

Open a command console, enter your project directory and execute:

```
composer require calliostro/spotify-web-api-bundle
```

### 🛠️ Applications that don't use Symfony Flex

[](#️-applications-that-dont-use-symfony-flex)

#### Step 1: Download the Bundle

[](#step-1-download-the-bundle)

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

```
composer require calliostro/spotify-web-api-bundle
```

#### Step 2: Enable the Bundle

[](#step-2-enable-the-bundle)

Then, enable the bundle by adding it to the list of registered bundles in the `config/bundles.php` file of your project:

```
// config/bundles.php

return [
    // ...
    Calliostro\SpotifyWebApiBundle\CalliostroSpotifyWebApiBundle::class => ['all' => true],
];
```

> **Supports Symfony 6.4, 7.x and 8.x!**

⚙️ Configuration
----------------

[](#️-configuration)

First, you must register your application at  to obtain the `client_id` and `client_secret`.

If you want to access user-related endpoints, the user must grant access to your application. Spotify provides OAuth 2.0 for this purpose. You need to register the `redirect_uri` in the Spotify dashboard. For the following example, you would add `https://127.0.0.1:8000/callback/` to the allowlist addresses.

For configuration, create a new `config/packages/calliostro_spotify_web_api.yaml` file. Here is an example:

```
# config/packages/calliostro_spotify_web_api.yaml
calliostro_spotify_web_api:

    # Your Client ID
    client_id:            '' # Required

    # Your Client Secret
    client_secret:        '' # Required

    # Options for SpotifyWebAPI client
    # https://github.com/jwilsson/spotify-web-api-php/blob/main/docs/examples/setting-options.md
    options:
        auto_refresh:     false
        auto_retry:       false
        return_assoc:     false

    # Address to redirect to after authentication success OR failure
    redirect_uri:         '' # Example: 'https://127.0.0.1:8000/callback/'

    # Service ID of the token provider that provides the user's access token
    token_provider:       calliostro_spotify_web_api.token_provider
```

🎬 Usage
-------

[](#-usage)

This bundle provides a single service for communication with Spotify Web API, which you can autowire by using the `SpotifyWebAPI` and `Session` type-hint:

### 🔑 Client Credentials

[](#-client-credentials)

This is the simpler option if no user-related endpoints are required.

```
// src/Controller/SomeController.php

use SpotifyWebAPI\SpotifyWebAPI;
// ...

class SomeController
{
    public function index(SpotifyWebAPI $api)
    {
        $search = $api->search('Thriller', 'album');

        var_dump($search);

        // ...
    }
}
```

### 🧑‍💻 Authorization Code

[](#‍-authorization-code)

If you want to access a Spotify user's profile or data, you must first redirect the user to Spotify's approval page. Then you can start the session.

```
// src/Controller/SpotifyController.php

namespace App\Controller;

use SpotifyWebAPI\Session;
use SpotifyWebAPI\SpotifyWebAPI;
use SpotifyWebAPI\SpotifyWebAPIAuthException;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class SpotifyController extends AbstractController
{
    public function __construct(
        private SpotifyWebAPI $api,
        private Session $session
    ) {}

    #[Route('/', name: 'home')]
    public function index(): Response
    {
        return new Response('
            Spotify Web API Demo
            Welcome to the Spotify Web API Bundle demonstration!
            Click here to authorize with Spotify
        ', 200, ['Content-Type' => 'text/html']);
    }

    #[Route('/callback')]
    public function callback(Request $request): Response
    {
        try {
            $this->session->requestAccessToken($request->query->getString('code'));
        } catch (SpotifyWebAPIAuthException) {
            return $this->redirectToRoute('authorize');
        }

        $this->api->setAccessToken($this->session->getAccessToken());
        $me = $this->api->me();

        return new Response('
            Spotify Authorization Successful!
            Welcome, ' . htmlspecialchars($me->display_name ?? 'Spotify User') . '!
            ' . htmlspecialchars(var_export($me, true)) . '
            Back to Home
        ', 200, ['Content-Type' => 'text/html']);
    }

    #[Route('/authorize', name: 'authorize')]
    public function authorize(): Response
    {
        $options = [
            'scope' => [
                'user-read-email',
            ],
        ];

        return $this->redirect($this->session->getAuthorizeUrl($options));
    }
}
```

> ⚠️ **Remember to set `redirect_uri` in the configuration file and allowlist it on Spotify!**

📚 Documentation
---------------

[](#-documentation)

See [jwilsson/spotify-web-api-php](https://github.com/jwilsson/spotify-web-api-php) for documentation of the SpotifyWebAPI service.

See [Spotify's Web API](https://developer.spotify.com/documentation/) full API documentation.

---

### ⚡ Supported Symfony Versions

[](#-supported-symfony-versions)

- **Symfony 6.4 (LTS)**
- **Symfony 7.x**
- **Symfony 8.x**

🤝 Contributing
--------------

[](#-contributing)

Implemented a missing feature? You can request it. And creating a pull request is an even better way to get things done.

---

🏁 Quick Start
-------------

[](#-quick-start)

1. Install the bundle with Composer
2. Configure your Spotify credentials
3. Autowire the service and start using the API!

💬 Support
---------

[](#-support)

For questions or help, feel free to open an issue or reach out! 😊

###  Health Score

49

—

FairBetter than 95% of packages

Maintenance75

Regular maintenance activity

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 88.2% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~214 days

Recently: every ~316 days

Total

9

Last Release

137d ago

Major Versions

v0.1.2 → v1.0.02021-07-01

PHP version history (4 changes)v0.1.0PHP &gt;=7.2.5

v1.0.0PHP ^7.3 || ^8.0

v1.1.1PHP ^7.3|^8.0|^8.1|^8.2

v1.2.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/793482279bf515fd4d7758e76f3b569bc3e2b41787b9d15901d2ed58d03c6b1b?d=identicon)[calliostro](/maintainers/calliostro)

---

Top Contributors

[![calliostro](https://avatars.githubusercontent.com/u/24731284?v=4)](https://github.com/calliostro "calliostro (15 commits)")[![yoanbernabeu](https://avatars.githubusercontent.com/u/59195351?v=4)](https://github.com/yoanbernabeu "yoanbernabeu (2 commits)")

---

Tags

api-clientaudiomusicphpspotifyspotify-apistreamingsymfonysymfony-bundleweb-apiphpsymfonystreamingaudioapi clientSymfony Bundlespotifymusicweb-apispotify-api

### Embed Badge

![Health badge](/badges/calliostro-spotify-web-api-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/calliostro-spotify-web-api-bundle/health.svg)](https://phpackages.com/packages/calliostro-spotify-web-api-bundle)
```

###  Alternatives

[kreait/firebase-bundle

Symfony Bundle for the Firebase Admin SDK

1534.7M2](/packages/kreait-firebase-bundle)[php-flasher/flasher-symfony

Integrate flash notifications into Symfony projects effortlessly with PHPFlasher. Improve user experience and application feedback loops easily.

141.3M20](/packages/php-flasher-flasher-symfony)[cmsig/seal-symfony-bundle

An integration of CMS-IG SEAL search abstraction into Symfony Framework.

15195.8k5](/packages/cmsig-seal-symfony-bundle)[kiwilan/php-audio

PHP package to parse and update audio files metadata, with `JamesHeinrich/getID3`.

3012.6k1](/packages/kiwilan-php-audio)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
