https://github.com/socialconnect/vk
ВКонтакте Social Network SDK
https://github.com/socialconnect/vk
php sdk vk vkontakte vkontakte-api vkontakte-client vkontakte-sdk
Last synced: 10 days ago
JSON representation
ВКонтакте Social Network SDK
- Host: GitHub
- URL: https://github.com/socialconnect/vk
- Owner: SocialConnect
- License: other
- Created: 2014-08-10T10:40:34.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2015-11-10T17:54:46.000Z (over 9 years ago)
- Last Synced: 2025-04-10T18:47:38.057Z (11 days ago)
- Topics: php, sdk, vk, vkontakte, vkontakte-api, vkontakte-client, vkontakte-sdk
- Language: PHP
- Homepage: http://sc.dmtry.me/
- Size: 660 KB
- Stars: 17
- Watchers: 8
- Forks: 7
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
#
ВКонтакте SDK
[](https://packagist.org/packages/SocialConnect/vk-sdk)
[](https://travis-ci.org/SocialConnect/vk)
[](https://scrutinizer-ci.com/g/SocialConnect/vk/?branch=master)
[](https://scrutinizer-ci.com/g/SocialConnect/vk/?branch=master)
[](https://packagist.org/packages/SocialConnect/vk)Library for work with VK API.
Installation
------------Add a requirement to your `composer.json`:
```json
{
"require": {
"socialconnect/vk": "~0.4"
}
}
```Run the composer installer:
```bash
php composer.phar install
```How to use
----------First you need to create service:
```php
// Your Vk Application Settings
$appId = 123456;
$appSecret = 'secret';$vkService = new \SocialConnect\Vk\Client($appId, $appSecret);
$vkService->setHttpClient(new \SocialConnect\Common\Http\Client\Curl());
```## Get user with specified $id:
```php
$user = $vkService->getUser(1);
var_dump($user);
```## Get users with specified array $ids:
```php
$users = $vkService->getUsers([1, 2]);
var_dump($users);
```## Customs methods
```php
$parameters = [];
$result = $vkService->request('method/CustomMethod', $parameters);
if ($result) {
var_dump($result);
}
```## Custom entities
```php
class MyUserEntitiy extends \SocialConnect\Vk\Entity\User {
public function myOwnMethod()
{
//do something
}
}$vkService->getEntityUser(new MyUserEntitiy());
$user = $vkService->getUser(1);if ($user) {
$user->myOwnMethod();
}
```License
-------This project is open-sourced software licensed under the MIT License. See the LICENSE file for more information.