Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laravelrus/vk-client
PHP client for Vk.com API
https://github.com/laravelrus/vk-client
api api-vk client php-client vk vkontakte vkontakte-api vkontakte-client
Last synced: 13 days ago
JSON representation
PHP client for Vk.com API
- Host: GitHub
- URL: https://github.com/laravelrus/vk-client
- Owner: LaravelRUS
- License: mit
- Archived: true
- Created: 2016-07-18T03:52:29.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-09-10T17:47:47.000Z (over 4 years ago)
- Last Synced: 2024-12-17T07:51:35.899Z (about 1 month ago)
- Topics: api, api-vk, client, php-client, vk, vkontakte, vkontakte-api, vkontakte-client
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 58
- Watchers: 9
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP client for Vk.com API
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/atehnix/vk-client/master/LICENSE)
[![Packagist Version](https://img.shields.io/packagist/v/atehnix/vk-client.svg)](https://packagist.org/packages/atehnix/vk-client)
[![Packagist Stats](https://poser.pugx.org/atehnix/vk-client/downloads)](https://packagist.org/packages/atehnix/vk-client/stats)## Installation
You can get library and all of it dependencies through [composer](https://getcomposer.org/)
`composer require atehnix/vk-client`
## Usage
### Simple example
```php
$api = new Client;$response = $api->request('wall.get', ['owner_id' => 1]);
```### Use Request class
```php
$api = new Client;$request = new Request('wall.get', ['owner_id' => 1]);
$response = $api->send($request);
```### Use ExecuteRequest class
Send multiple requests at once
```php
$api = new Client;$execute = ExecuteRequest::make([
new Request('wall.get', ['owner_id' => 1]),
new Request('wall.get', ['owner_id' => 2]),
// ... few requests
new Request('wall.get', ['owner_id' => 25]),
]);$response = $api->send($execute);
```### Use a specific version of the API.
```php
$api = new Client('5.60');
```### Use with access token
Set default token in client.
```php
$api = new Client;$api->setDefaultToken("some_token");
// ...
```Or set token for specific request.
```php
$api = new Client;// Token in the request is a higher priority than the default token.
$request = new Request('wall.get', ['owner_id' => 1], "some_token");// ...
```### Authorization
```php
$auth = new Auth('client_id', 'client_secret', 'redirect_uri');// ...
$token = $auth->getToken($_GET['code']);
```### License
[MIT](https://raw.github.com/atehnix/vk-client/master/LICENSE)