Download the PHP package mezuky04/larafy without Composer

On this page you can find all versions of the php package mezuky04/larafy. 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 larafy

Build Status codecov StyleCI Latest Stable Version Total Downloads Monthly Downloads License

PayPal

This package is no longer maintained!

Larafy

Larafy is a PHP API Wrapper for Spotify API. This wrapper is more oriented over Client Credentials authenticated endpoints and provides great interface and and eloquent way to search for tracks, seed genres or simply just provide custom tracks/albums listings for your users.

Installation

Install the package:

If your Laravel version does not support package discovery, add this line in the providers array in your config/app.php file:

Setting up the API

For this, you will need an APP ID and an APP SECRET from your Spotify API Dashboard.

For a cleaner approach, add the following to your config/services.php file:

To use the API, you just pass no construct parameters to Rennokki\Larafy\Larafy:

If you want to change the credentials on-demand, you can do so by declaring a new API instance with your App ID and your App Secret:

Showcase

All requests throw exceptions, either if the data is invalid, either if the request is... bad. To do so, there are provided two exceptions that can be caught:

Since Spotify is related to music, it has some certain restrictions over markets and locales. This happens because, for example, some albums that are available in a country may not be available in other countries, such as the AC/DC's The Razor Edge album, that has different versions across countries like Austrialia or the US.

To help give a better search over the market and, respectively, locales, use the setMarket() and setLocale() methods within the API instance. These are by default set to US and en_US. These are optional.

You can chain them:

Or set them on demand:

Some requests need an offset and a limit, which are optional and set by default to 0 and respectively 10. The limit is how many results can be shown in the request and the offset indicates how many results to offset, starting from the first. See the next examples on how you can use this feature.

When retrieving multiple data, you can either pass an array or a string with comma-separated values:

When issuing requests on endpoints that might return more data, usually this is done by accessing the items property:

For the getArtistAlbums() method, there is an option to search artist's albums based on the fact it is a single or the artist appears on that album. To do so, there is applied the same rule as the comma-separated values or array method.

API Usage

Recommendations

Recommendations allows you to query up the Spotify API into getting something personalized. The Recommendations endpoint allows you to do that by seeding tracks, genres and artists and a bunch of adjustable properties such as energy, key and danceability to get personalized tracks for your users.

Before getting into it, make sure you are familiar with the Recommendations Endpoint.

Each track has its own properties such as key, danceability, energy or loudness. To do so, the \Rennokki\Larafy\LarafySeed class helps you build your seed easier. Let's start with an example:

In the previous example, we just have searched tracks from Death Metal, Hard Rock and Black Metal whose valence (the positivity; the higher, the more positive) is around 90.3, and then we set some ranges for speechiness (the higher, the less musical it is: podcasts), loudness and liveness (the higher, the more chances it is a live performance).

To get the available seeds, you may use the $api->getGenreSeeds() to get a list of possible values for the setGenres() method.

There is a difference between:

When setting up a range, it might vary between two values. When setting up a target value, it just gets around it as much as possible. Read more about each seed here

To add artists, tracks or genres, you may use:

For tunable properties of the songs, you can use the following methods:

Note: While building your seed, you can chain how many properties you want.

Albums

API Reference on Albums

Tracks

API Reference on Tracks

Artists

API Reference on Artists

Playlists

API Reference on Playlists

Browse

API Reference on Browse


All versions of larafy with dependencies

PHP Build Version
Package Version
Requires guzzlehttp/guzzle Version ^6.3@dev
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 mezuky04/larafy contains the following files

Loading the files please wait ....