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: 2 months 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 9 years ago)
- Default Branch: master
- Last Pushed: 2020-09-10T17:47:47.000Z (about 5 years ago)
- Last Synced: 2025-09-01T01:23:25.925Z (3 months ago)
- Topics: api, api-vk, client, php-client, vk, vkontakte, vkontakte-api, vkontakte-client
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 58
- Watchers: 8
- Forks: 16
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP client for Vk.com API
[](https://raw.githubusercontent.com/atehnix/vk-client/master/LICENSE)
[](https://packagist.org/packages/atehnix/vk-client)
[](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)