dev-master
9999999-devUse Last.fm API in your Symfony 2 application.
MIT
The Requires
- php >=5.3.2
- symfony/framework-bundle 2.*
by Karol Sójko
api lastfm last.fm
Use Last.fm API in your Symfony 2 application.
Symfony 2 Bundle for Last.fm API, (*2)
This is a Bundle that will help you communicate with Last.fm's API., (*3)
The Bundle handles API methods for following contexts (Please see Milestones on github): - Album - Artist - Chart - Geo - Library - Tag - User, (*4)
Stay tuned for more coming soon., (*5)
If you're using composer just add:, (*6)
{ "require": { "binarythinking/lastfm-bundle": "dev-master" } }
If you're using a deps file just add:, (*7)
[BinaryThinkingLastfmBundle] target=/bundles/BinaryThinking/LastfmBundle git=http://github.com/karolsojko/BinaryThinkingLastfmBundle.git
Register the BinaryThinking namespace in autoload.php, (*8)
<?php $loader->add('BinaryThinking', __DIR__ . '/../vendor/bundles');
And the bundle to AppKernel.php, (*9)
<?php $bundles = array( // ... new BinaryThinking\LastfmBundle\BinaryThinkingLastfmBundle() );
After installing just configure your application with your Last.fm API key and secret., (*10)
In your config define those two as:, (*11)
binary_thinking_lastfm: client_apikey: "my_api_key" client_secret: "my_secret"
In your controller if you want for example a client for the album API context just get the service like this:, (*12)
<?php $albumClient = $this->get('binary_thinking_lastfm.client.album');
Or you can get the client factory and request for a specific client f.e. album:, (*13)
<?php $clientFactory = $this->get('binary_thinking_lastfm.client_factory'); $albumClient = $clientFactory->getClient('album', $apiKey, $apiSecret);
Once you have your client you can use on it the methods that are available in the Last.fm API f.e., (*14)
<?php // search for an album $albums = $albumClient->search('Sound of perseverance'); // get detailed info on an album $album = $albumClient->getInfo('Cynic', 'Focus');
Use Last.fm API in your Symfony 2 application.
MIT
api lastfm last.fm