Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chipslays/vk-music
🎵 A simple wrapper for VK Music API.
https://github.com/chipslays/vk-music
audio library music vk vk-audio vk-music
Last synced: 6 days ago
JSON representation
🎵 A simple wrapper for VK Music API.
- Host: GitHub
- URL: https://github.com/chipslays/vk-music
- Owner: chipslays
- License: mit
- Created: 2021-06-30T02:28:09.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-06-30T10:05:53.000Z (over 3 years ago)
- Last Synced: 2024-10-24T06:28:34.765Z (22 days ago)
- Topics: audio, library, music, vk, vk-audio, vk-music
- Language: PHP
- Homepage:
- Size: 6.84 KB
- Stars: 3
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# 🎵 VK Music API for PHP
A simple wrapper for VK Music API.
> For use this library, first you need get a token and user-agent.
>
> See for more [`vodka2/vk-audio-token`](https://github.com/vodka2/vk-audio-token).## Installation
```bash
composer require chipslays/vk-music
```## Usage
```php
use Chipslays\VkMusic\Client;$client = new Client('YOUR_TOKEN', 'YOUR_USERAGENT');
$response = $client->search('Justin Bieber - Baby');
print_r($response->toArray());
// Array
// (
// [count] => 3693
// [items] => Array
// (
// [0] => ...
// [1] => ...
// [2] => ...
// )
// )
```You can get the value using dot notation by [`chipslays/collection`](https://github.com/chipslays/collection).
```php
print_r($response->get('items.0.artist'));
```## Methods
> **NOTICE:** Optional parameter `$extra` is a array of parameters with `key => value`.
#### `search(string $q, int $count = 10, int $offset = 0, array $extra = []): Collection`
```php
$client->search('Justin Bieber - Baby');
```#### `getById(string|array $audios): Collection`
```php
$client->getById(['371745461_456289486', '-41489995_202246189']);
```#### `get($owner_id, int $count = 10, int $offset = 0, $extra = []): Collection`
```php
$client->get('371745461');
```#### `getPlaylists($owner_id, int $count = 10): Collection`
```php
$client->getPlaylists('371745461');
```#### `getRecommendations(int $count = 10): Collection`
```php
$client->getRecommendations();
```#### `getPopular(int $count = 10): Collection`
```php
$client->getPopular();
```#### `method(string $method, array $params): Collection`
```php
$client->method('audio.search', [
'q' => 'Justin Bieber - Baby',
'count' => '10',
]);
```## Helpers
You can use `vk_music` helper instead `Client` class.
```php
$client = vk_music('YOUR_TOKEN', 'YOUR_USERAGENT');
```## Todo
* Write tests 😴💤
## License
MIT