Skip to content

Commit

Permalink
add composer file
Browse files Browse the repository at this point in the history
move to src folder
  • Loading branch information
fdcore committed Sep 17, 2016
1 parent a591169 commit 6aaed80
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog

# 2.0
* Add composer
* Stable release
File renamed without changes.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,26 @@ To work with api you need to perform several actions:
2. Get access_token (see below)
3. Set **client_id** and **secret_key** application.

## USAGE

With composer

```php
<?php
include 'vendor/autoload.php';
$v = new Vk();
?>
```

Without

```php
<?php
include 'vk.php';
$v = new Vk();
?>
```

## Get access_token
Execute method get_code_token for get link. Go to link and get access app, after you redirected on blank page with access_token on hash url.

Expand Down
21 changes: 21 additions & 0 deletions README_RU.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,27 @@ Vkontakte Api for PHP
2. Получить access_token (об этом ниже)
3. Классу нужно передать **client_id** приложения и секретный ключ который вам даётся при создании приложения

## Использование

C composer

```php
<?php
include 'vendor/autoload.php';
$v = new Vk();
?>
```

без

```php
<?php
include 'vk.php';
$v = new Vk();
?>
```


## Получение access_token

Выполним метод get_code_token для получения ссылки которая вернёт нам code
Expand Down
20 changes: 20 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "fdcore/vk.api",
"description": "Vk api extension",
"authors": [
{
"name": "Dmitriy Nyashkin",
"email": "[email protected]"
}
],
"version":"2.0",
"require": {
"php":">=5.4.0"
},
"require-dev": {
"phpunit/phpunit": "~3.7.0"
},
"autoload": {
"files": ["src/vk.php"]
}
}
2 changes: 1 addition & 1 deletion example/_connect_vk.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

require '../vk.php'; //
require '../vendor/autoload.php'; //

$config['secret_key'] = ''; // ваш секретный ключ приложения
$config['client_id'] = 0; // (обязательно) получить тут https://vk.com/apps?act=manage где ID приложения = client_id
Expand Down
2 changes: 0 additions & 2 deletions example/wall_delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@

require '_connect_vk.php';

$v = new Vk($config);

$response = $v->api('wall.delete', array('post_id' => 0));
6 changes: 3 additions & 3 deletions vk.php → src/vk.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Class Vk
* @author: Dmitriy Nyashkin
* @link: https://github.com/fdcore/vk.api
* @version: 2
* @version: 2.0
*/

// Возвращаемые ошибки https://vk.com/dev/errors
Expand All @@ -12,7 +12,7 @@ class VkException extends Exception {};

class Vk{

private $v = '5.35'; // версия Api VKontakte @link https://vk.com/dev/versions
private $v = '5.53'; // версия Api VKontakte @link https://vk.com/dev/versions
const VERSION = '2.0'; // версия этой библиотеки

const CALLBACK_BLANK = 'https://oauth.vk.com/blank.html';
Expand Down Expand Up @@ -64,6 +64,7 @@ public function api($method = '', array $vars = []){
$params = http_build_query($vars);
$url = $this->http_build_query($method, $params);

print $url;
return $this->call($url);
}

Expand Down Expand Up @@ -368,4 +369,3 @@ public function uploadVideosFromArray(array $videos){
return $attached_videos;
}
}

0 comments on commit 6aaed80

Please sign in to comment.