niland / api-client-php
Niland API Client for PHP
Installs: 5 090
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 4
Forks: 2
Open Issues: 0
Requires
- guzzlehttp/guzzle: ~6.0
This package is not auto-updated.
Last update: 2025-04-26 22:01:22 UTC
README
Setup
To setup your project, follow these steps:
- Install the package via Composer:
composer require niland/api-client-php
- Next you'll have to initialize the client with your API-Key. You can find it on your Niland API account.
// composer autoload require __DIR__ . '/vendor/autoload.php'; $client = new \NilandApi\Client(YOUR_API_KEY);
Quick Start
List tracks using pagination
$response = $client->get('tracks', array('page_size' => 10, 'page' => 2));
Retrieve a track by its reference
$response = $client->get('tracks/reference/YOUR_REFERENCE');
Find tracks by similarity and/or tags
$response = $client->get('tracks/search', array( 'similar_ids' => array(1234), 'tag_ids' => array(21, 41) ));
Post a track
$response = $client->post('tracks', array( 'title' => 'foobar', 'artist' => 'foobar', 'reference' => 'foobar', 'tags' => array(21, 41), 'audio' => fopen('/path/to/your/audio/file.mp3', 'r') ));
Known Issues
You will get a 400 Bad Request
if you use a URL in fopen
with PHP 7. It generate an invalid chunk body error.
The following exemple will generate a 400:
$response = $client->post('tracks', array( 'title' => 'foobar', 'artist' => 'foobar', 'reference' => 'foobar', 'tags' => array(21, 41), 'audio' => fopen('http://myawesomewebsite.com/file.mp3', 'r') ));