PHPackages                             opmyukka/vk - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. opmyukka/vk

ActiveLibrary[API Development](/categories/api)

opmyukka/vk
===========

Library for work with API Vk.com

0.6.0(9y ago)015MITPHPPHP &gt;=5.5.0

Since May 10Pushed 9y ago1 watchersCompare

[ Source](https://github.com/opmyukka/VkApiPHP)[ Packagist](https://packagist.org/packages/opmyukka/vk)[ RSS](/packages/opmyukka-vk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (10)Used By (0)

Vk API PHP
==========

[](#vk-api-php)

[![Build Status](https://camo.githubusercontent.com/dc68ab84981d92d042df7bd5918c6d421218db9d0181b9976fae584cc3048264/68747470733a2f2f7472617669732d63692e6f72672f6765746a756d702f566b4170695048502e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/getjump/VkApiPHP)[![Code Style Status](https://camo.githubusercontent.com/bbe5c910f61cfe9f554922c794f71eb50c844c09a2e2f82a02b185865ac49cd9/68747470733a2f2f7374796c6563692e696f2f7265706f732f31393431383739322f736869656c64)](https://styleci.io/repos/19418792)

That library will help you organize your work with API Vk.com

Installation
------------

[](#installation)

You can get library and all of it dependencies through [composer](https://getcomposer.org/)

`composer require "getjump/vk:*"`

Explanation
-----------

[](#explanation)

Okay, that is how we can instantiate main object for our future requests

```
$vk = getjump\Vk\Core::getInstance()->apiVersion('5.5')->setToken(>>> HERE YOUR TOKENS GOES request('friends.get', ['user_id' => '15157875'])->each(function($i, $v) {});
```

That us long polling shiet, it works like a hell, as fast as you can see.

```
// Long pooling loop
$lp = new getjump\Vk\Wrapper\LongPoll($vk);
$lp->doLoop();
```

We will do badass stuff, like kiss. You can do like the following and it will works

```
//KISS
$user=new getjump\Vk\Wrapper\User(getjump\Vk\Core::getInstance()->apiVersion('5.5'));
$user->get(1, 'photo_max_orig, sex'); //It will contain RequestTransaction, and will wait for your action, like getting response ->response or calling ->each(callback)
//Since __get and __call are overrided, we will request for a data, only when it neeeded
```

We can use my own sakhalin technilogies and take all the stuff that VK have for that request using generators

```
// Friends gets
$friends = new getjump\Vk\Wrapper\Friends($vk);
foreach($friends->get(15157875, 'first_name, last_name')->batch(100) as $f) //BATCH MEAN $f WILL CONTAIN JUST 100 ELEMENTS, AND REQUEST WILL MADE FOR 100 ELEMENTS
{
    /**
     * @var $f \getjump\Vk\ApiResponse;
     */

    $f->response->each(function($i, $j) {
        if(!$j->online) return;
        print $j->getName() . '';
    });
}
```

But you still can do old style stuff

```
 //SECOND OPTION TO JUST GET EVERYTHING, WITHOUT count BEING SEND
$friends->get(15157875, 'first_name, last_name')->response->each(function($i, $d) {
     if($d->online)
     {
         print $d->getName() . '';
     }
});
```

That snippet will show you your last 200 messages

```
//MESSAGES
$data = $vk->request('messages.get', ['count' => 200]);

$userMap = [];
$userCache = [];

$user = new \getjump\Vk\Wrapper\User($vk);

$fetchData = function($id) use($user, &$userMap, &$userCache)
{
    if(!isset($userMap[$id]))
    {
        $userMap[$id] = sizeof($userCache);
        $userCache[] = $user->get($id)->response->get();
    }

    return $userCache[$userMap[$id]];
};

//REQUEST WILL ISSUE JUST HERE! SINCE __get overrided
$data->each(function($key, $value) use($fetchData) {
    $user = $fetchData($value->user_id);
    printf("[%s] %s ", $user->getName(), $value->body);
    return;
});
```

Once more black magic. VK has method called execute, that can take something like JS code. Look what i've done for that.

```
$js1 = $vk->request('messages.get', ['count' => 200, 'offset' =>0 * 200])->toJs(); //IT WILL RETURN VkJs object
$js2 = $vk->request('messages.get', ['count' => 200, 'offset' =>1 * 200])->toJs();
$js3 = $vk->request('messages.get', ['count' => 200, 'offset' =>2 * 200])->toJs();
$js4 = $vk->request('messages.get', ['count' => 200, 'offset' =>3 * 200])->toJs();

$js1
        ->append($js2) // WE ARE APPENDING js2 to js1
        ->append($js3)
        ->append($js4)
        ->execute() // WE WANT EXECUTE THIS (actually it will return RequestTransaction)
        ->response //AS FOR NOW WE REALLY DO SOME REQUEST TO API
        ->each(
            function($i, $v) //FIRST CALLBACK IS NEEDED TO GO FOR EVERY PART OF RESPONSE, ARRAY WITH 4-ELS IN OUR CASE
            {
                $v->each(function($c, $d) { // SECOND TO CHECK EVERY ELEMENTS IN ARRAY WITH 200 ELEMENTS
                    if(isset($d->body)) print $d->body; //WE JUST OUTPUTTING MESSAGE IF IT SET
                });
            });

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.9% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~180 days

Recently: every ~222 days

Total

6

Last Release

3481d ago

PHP version history (2 changes)0.1.0PHP &gt;=5.5.0

0.2.0PHP &gt;=5.4.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/213d149fc35090db67105beae04ffc289af97cac6abd13eb61383f17004e2670?d=identicon)[opmyukka](/maintainers/opmyukka)

---

Top Contributors

[![getjump](https://avatars.githubusercontent.com/u/1342807?v=4)](https://github.com/getjump "getjump (56 commits)")[![yakud](https://avatars.githubusercontent.com/u/796742?v=4)](https://github.com/yakud "yakud (8 commits)")[![zom-2018](https://avatars.githubusercontent.com/u/29785235?v=4)](https://github.com/zom-2018 "zom-2018 (5 commits)")[![distroid](https://avatars.githubusercontent.com/u/7666281?v=4)](https://github.com/distroid "distroid (1 commits)")[![vudaltsov](https://avatars.githubusercontent.com/u/2552865?v=4)](https://github.com/vudaltsov "vudaltsov (1 commits)")

---

Tags

phpapilibraryvkvkontakte

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/opmyukka-vk/health.svg)

```
[![Health](https://phpackages.com/badges/opmyukka-vk/health.svg)](https://phpackages.com/packages/opmyukka-vk)
```

###  Alternatives

[getjump/vk

Library for work with API Vk.com

20048.5k](/packages/getjump-vk)[checkout/checkout-sdk-php

Checkout.com SDK for PHP

553.3M7](/packages/checkout-checkout-sdk-php)[digitalstars/simplevk

Powerful PHP library/framework for VK API bots, supporting LongPoll &amp; Callback &amp; OAuth

883.9k3](/packages/digitalstars-simplevk)[fabian-beiner/todoist-php-api-library

A PHP client library that provides a native interface to the official Todoist REST API.

4810.8k](/packages/fabian-beiner-todoist-php-api-library)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
