Download the PHP package dandelionmood/lastfm without Composer

On this page you can find all versions of the php package dandelionmood/lastfm. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package lastfm

Last.fm API PHP Wrapper

Introduction

When I looked for an API to work with Last.fm API, I could only find either incomplete implementations or very complicated ones. I love simple things so I decided to take my chance and design a simple class that could do everything in the most simple way.

The key idea is that the official documentation is very good, and you shoudn't need anything else to work with the API.

Installation

You should install it through Composer / Packagist, because … Well, it's awesome !

The package is available here on Packagist.

Standard methods (no authentication needed)

Let's dive into the meat of this project. First, you need to register your application to key an API key and secret.

Once it's done, here's how you get an instance to work with :

Now let's say you want to get info on a given artist ? If you look into the API documentation, you can find the method that will give us what we need (see here).

What you'll get in return is a standard PHP Object.

Authenticated methods

Some methods requires you to authenticate the user first. The PHP API gives you two methods to do this. This is very similar to OAuth and OpenID authentication, so if you've every implemented it before, you should feel right at home.

Authentication

Please look in the file to find a Slim application implementing it. I will use portions of this file here to guide you step by step.

First, we need to ask the user to allow our application, this is handled by Last.fm ; they need to know what URL to call when the user says yes :

Secondly, we need to handle the callback URL that will be called when the user validates the form :

I decided to print out the session key, but you should keep it in a database or the variable : YMMV …

Authenticated methods

The user is now authenticated, we now know its ; we can use it as a third parameter when calling the constructor.

Here's a simple authenticated method that takes the in the URL and posts a message on my wall :

You need to add a third parameter when calling the function to let the API know it's an authenticated call.

Last words

You can generate the class documentation using the command.

The unit tests are very scarce at the moment, but they should work if you specify your own api key and secret, look in . You can launch them by calling the command/


All versions of lastfm with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
kriswallsmith/buzz Version ^1.0
nyholm/psr7 Version ^1.1
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dandelionmood/lastfm contains the following files

Loading the files please wait ....