Skip to content

Commit 1113131

Browse files
authored
Merge pull request #8 from Hopex-Development/dev
Dev
2 parents 59462ea + 75a3f62 commit 1113131

File tree

306 files changed

+7632
-6642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

306 files changed

+7632
-6642
lines changed

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
> Copyright (c) 2022 [Schizo](https://vk.com/id244036703), [AnnieNiku](https://vk.com/id116596882)
3+
> Copyright (c) 2022 [Schizo](https://vk.com/id244036703), translated by [AnnieNiku](https://vk.com/id116596882)
44
55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,47 @@
11
<p align="center">
2-
<img src="https://packages-api.hopex.ru/packages/laravel-vk-sdk/logo.png" width="100%" alt="Laravel VK API SDK Logo">
2+
<img src="https://packages-api.hopex.ru/storage/vk-api-sdk/banner.png" width="100%" alt="Laravel VK API SDK Logo">
33
</p>
44

5-
# <span style="color:#F55D5C">Laravel</span> <span style="font-size:1rem">VK API SDK</span>
6-
7-
<p>
8-
<img alt="Version Badge" src="https://img.shields.io/endpoint?url=https://packages-api.hopex.ru/laravel-vk-sdk/badges/version/package">
9-
<img alt="VK Badge" src="https://img.shields.io/endpoint?url=https://packages-api.hopex.ru/laravel-vk-sdk/badges/version/api">
10-
<img alt="PHP Badge" src="https://img.shields.io/endpoint?url=https://packages-api.hopex.ru/laravel-vk-sdk/badges/version/php">
11-
<img alt="Laravel Badge" src="https://img.shields.io/endpoint?url=https://packages-api.hopex.ru/laravel-vk-sdk/badges/version/laravel">
12-
<img alt="License Badge" src="https://img.shields.io/endpoint?url=https://packages-api.hopex.ru/laravel-vk-sdk/badges/license">
5+
<p align="center">
6+
<img alt="Downloads" src="https://packages-api.hopex.ru/api/vk-api-sdk/packagist/hopex/downloads">
7+
<img alt="Stars" src="https://packages-api.hopex.ru/api/vk-api-sdk/packagist/hopex/stars">
8+
<img alt="Laravel" src="https://packages-api.hopex.ru/api/vk-api-sdk/version/laravel">
9+
<img alt="PHP" src="https://packages-api.hopex.ru/api/vk-api-sdk/version/php">
10+
<img alt="License" src="https://packages-api.hopex.ru/api/vk-api-sdk/license">
1311
</p>
1412

15-
[Laravel](https://github.com/laravel/laravel) библиотека для упрощенного использования API модулей социальной сети ВКонтакте.
16-
Предназначена для быстрого развертывания приложений-ботов, а также использования VK API в одностороннем порядке.
13+
# About
14+
The VK API SDK library is developed for the Laravel framework, it will allow you to use most of the modules of the VKontakte social network simply.
15+
We have linked VKontakte entities to each other in such a way that you can quickly build the subqueries.
16+
The library provides a good foundation for deploying complex bots and includes the following functionality:
17+
- Simple and quick confirmation of the Callback server: routes have already been created
18+
- Processing community events (new message, wall post, etc.)
19+
- Sending messages of various types to personal and group chats
20+
- Adding censorship to messages and player names sent from the game server
21+
- Integration with game servers (SourceQuery)
22+
- The use of an unlimited number of communities and game servers
1723

18-
### Содержание
19-
* [Приступая к работе](#Приступая к работе)
20-
* [Установка](#Установка)
21-
* [Внутренние зависимости](#Внутренние зависимости)
22-
* [Лицензия](#license)
2324

24-
## Приступая к работе
25+
# Installing
26+
27+
1. Run the command using [composer](https://getcomposer.org/):
2528

26-
### Установка
27-
Установка пакета через [composer](https://getcomposer.org/):
2829
```
29-
composer require hopex/vk-api-sdk
30+
composer req hopex/vk-api-sdk
3031
```
3132

32-
#### Внутренние зависимости
33-
Публикация зависимостей:
33+
2. Publish resources:
34+
3435
```
35-
php artisan vendor:publish --provider=Hopex\VkSdk\Providers\ServiceProvider --tag=vk-sdk-config --tag=vk-sdk-lang
36+
php artisan vendor:publish --tag=vk-sdk-config --tag=vk-sdk-lang --tag=vk-sdk-sources
3637
```
3738

38-
Провайдер и фасады будут автоматически зарегистрированы, однако вы можете вручную добавить их в `config/app.php`.
39-
```php
40-
'providers' => [
41-
// ...
42-
Hopex\VkApiSdk\Providers\VkApiSdkServiceProvider::class,
43-
],
44-
'aliases' => Facade::defaultAliases()->merge([
45-
// ...
46-
'VkApiSdk' => \Hopex\VkApiSdk\Facade::class,
47-
])->toArray(),
39+
3. Migrate the necessary tables:
40+
41+
```
42+
php artisan migrate
4843
```
4944

50-
# Лицензия <span style="font-size: 1rem">[MIT](https://github.com/H0pex/vk-api-sdk/LICENSE)</span>
45+
## License
46+
47+
The VK API SDK for Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

composer.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,28 @@
11
{
22
"name": "hopex/laravel-vk-sdk",
3-
"description": "Laravel SDK для быстрого развертывания приложений-ботов и простого использования VK API.",
3+
"description": "Laravel SDK for fast deployment of bot applications and easy use of VK API.",
44
"type": "library",
55
"license": "MIT",
66
"version": "0.0.2",
7-
"keywords": ["php", "laravel", "vk", "api", "sdk"],
7+
"keywords": [
8+
"php",
9+
"laravel",
10+
"vk",
11+
"api",
12+
"sdk"
13+
],
814
"authors": [
915
{
1016
"name": "Schizo",
1117
"email": "hopex.schizo@gmail.com",
1218
"homepage": "https://github.com/H0pex"
1319
}
1420
],
21+
"repository": "https://github.com/Hopex-Development/laravel-vk-sdk",
1522
"require": {
16-
"php": "^7.4||^8",
17-
"ext-json": "*"
18-
},
19-
"require-dev": {
23+
"php": "^8",
24+
"ext-json": "*",
25+
"xpaw/php-source-query-class": "^2.1"
2026
},
2127
"autoload": {
2228
"psr-4": {
@@ -29,9 +35,10 @@
2935
"Hopex\\VkSdk\\Providers\\ServiceProvider"
3036
],
3137
"aliases": {
32-
"Group": "Hopex\\VkSdk\\Facades\\Group",
38+
"VkApi": "Hopex\\VkSdk\\Facades\\VkApi",
3339
"Format": "Hopex\\VkSdk\\Facades\\Format",
34-
"Configure": "Hopex\\VkSdk\\Facades\\Configure"
40+
"SdkConfig": "Hopex\\VkSdk\\Facades\\SdkConfig",
41+
"RequestFields": "Hopex\\VkSdk\\Facades\\RequestFields"
3542
}
3643
}
3744
},

src/.root/config/vk-sdk.php

Lines changed: 98 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
<?php /** @noinspection GrazieInspection */
1+
<?php
2+
3+
use App\VK\Kult\EventsMapper;
4+
use App\VK\Kult\RequestsMapper;
5+
use App\VK\Tests;
6+
use Hopex\VkSdk\Formatters\JsonLogFormatter;
27

38
return [
49

@@ -13,7 +18,8 @@
1318
*/
1419

1520
'routes' => [
16-
'entry' => 'connect',
21+
'group' => 'callbacks',
22+
'server' => 'requests',
1723
],
1824

1925
/*
@@ -56,22 +62,76 @@
5662

5763
// TODO: исправить документацию для api и groups
5864
'api' => [
59-
'endpoint' => 'https://api.vk.com/method/',
60-
'version' => '5.131',
65+
'auth' => 'https://oauth.vk.com',
66+
'endpoint' => 'https://api.vk.com/method',
67+
'version' => '5.131',
68+
],
69+
70+
'replacement' => [
71+
'replace_to' => '(🚫)',
72+
'forbidden' => [
73+
'(@)',
74+
'(\*)',
75+
'(http)',
76+
'(\.com)',
77+
'(\.de)',
78+
'(\.net)',
79+
'(\.uk)',
80+
'(\.cn)',
81+
'(\.org)',
82+
'(\.info)',
83+
'(\.nl)',
84+
'(\.eu)',
85+
'(\.ru)',
86+
'(\.co\.uk)',
87+
'(\.me\.uk)',
88+
'(\.org\.uk)',
89+
'(\.sch\.uk)',
90+
],
6191
],
6292

6393
'groups' => [
64-
'84942932' => [
94+
84942932 => [
95+
'description' => 'Test service',
6596
'confirmation' => '28ec36c3',
6697
'token' => 'vk1.a.-U95XUjpt2OxcSqyPydks69FwG1fAHxY5CF7pUFC-d0oG9bY4ld2HO23VQCBF8xbrS2gLDE2QXyLSH6jsCaGw5lGc2M-n8aAbwToCGLp97LiS5Lf3Ha1En3LQshkdLlZkqKS80METKyr_3nSIBF4GJLAxZNvnSd12hXe3PYZAG0oTIkVPgdguVrbs8EEcAGv',
6798
'secret' => [
6899
'code' => '745cc77d276cf36c694e',
69100
'verify' => true,
70101
],
71-
'events' => \App\VK\Chat::class
102+
'server_peer_id' => 0,
103+
'target_server' => '',
104+
'events' => Tests::class,
105+
'allow_retry_events' => true,
106+
],
107+
205402271 => [
108+
'description' => 'Kult Game Project',
109+
'confirmation' => '1129612b',
110+
'token' => 'vk1.a.j-mrHaaBmC8Uq_GlAqwVjG2UALgWLYFqkq-Wgr2bGlO7LHZmT5km24yi2EZU2op1sAD4NHcFq2_KPo3IEwZCvMlywO6whuI8i00kFXBTM-w0lI1RVD534whyOPLZMoCoB2JMH12no5EC7dMUa3Jd63uc1DOlCKTV8GJQi2DG2piDsv_OfC3nrKBy0DQa3q-tr6Ei6HIZ-OW5EZaOw37nNg',
111+
'secret' => [
112+
'code' => 'ymUrvxeTHfUyRtdK',
113+
'verify' => true,
114+
],
115+
'server_peer_id' => 2000000002,
116+
'target_server' => '46.3.223.76:27015',
117+
'events_handler' => EventsMapper::class,
118+
'allow_retry_events' => true
72119
],
73120
],
74121

122+
'servers' => [
123+
'46-3-223-76-27015' => [
124+
'target_group_id' => 205402271,
125+
'rcon_password' => 'Nr8v6uxuCL8cA5NOx43cypz0DuaqCGP',
126+
'requests_handler' => RequestsMapper::class
127+
],
128+
],
129+
130+
'auth_app' => [
131+
'token' => 'b89c4892b89c4892b89c4892aeb8e5dc9fbb89cb89c4892d9c7b14801fb3358d6dcd092',
132+
'secret' => 'OaQA1ddYuF2PLGAGKOjd',
133+
],
134+
75135
/*
76136
|--------------------------------------------------------------------------
77137
| Логирование
@@ -91,60 +151,45 @@
91151
'enabled' => true,
92152
'channels' => [
93153
'exception' => [
94-
'name' => 'vk-sdk',
154+
'name' => 'vk-sdk-exception',
95155
'driver' => 'daily',
96156
'path' => storage_path('logs/vk-sdk/exceptions.log'),
97157
'level' => env('LOG_LEVEL', 'debug'),
98158
'permissions' => 0755,
99159
'locking' => true,
100160
'days' => 30,
101-
'tap' => \Hopex\VkSdk\Formatters\JsonLogFormatter::class,
161+
'tap' => JsonLogFormatter::class,
162+
],
163+
'info' => [
164+
'name' => 'vk-sdk-infos',
165+
'driver' => 'daily',
166+
'path' => storage_path('logs/vk-sdk/infos.log'),
167+
'level' => env('LOG_LEVEL', 'debug'),
168+
'permissions' => 0755,
169+
'locking' => true,
170+
'days' => 30,
171+
'tap' => JsonLogFormatter::class,
172+
],
173+
'source' => [
174+
'name' => 'vk-sdk-sources',
175+
'driver' => 'daily',
176+
'path' => storage_path('logs/vk-sdk/sources.log'),
177+
'level' => env('LOG_LEVEL', 'debug'),
178+
'permissions' => 0755,
179+
'locking' => true,
180+
'days' => 30,
181+
'tap' => JsonLogFormatter::class,
182+
],
183+
'server' => [
184+
'name' => 'vk-sdk-server',
185+
'driver' => 'daily',
186+
'path' => storage_path('logs/vk-sdk/server.log'),
187+
'level' => env('LOG_LEVEL', 'debug'),
188+
'permissions' => 0755,
189+
'locking' => true,
190+
'days' => 30,
191+
'tap' => JsonLogFormatter::class,
102192
],
103193
],
104194
],
105-
106-
/*
107-
|--------------------------------------------------------------------------
108-
| Базовые коды ошибок
109-
|--------------------------------------------------------------------------
110-
*/
111-
112-
'errors' => [
113-
'1' => \Hopex\VkSdk\Exceptions\Api\Common\UnknownException::class,
114-
'2' => \Hopex\VkSdk\Exceptions\Api\Common\DisabledException::class,
115-
'3' => \Hopex\VkSdk\Exceptions\Api\Methods\MethodException::class,
116-
'4' => \Hopex\VkSdk\Exceptions\Api\Common\SignatureException::class,
117-
'5' => \Hopex\VkSdk\Exceptions\Api\Auth\AuthException::class,
118-
'6' => \Hopex\VkSdk\Exceptions\Api\Common\TooManyException::class,
119-
'7' => \Hopex\VkSdk\Exceptions\Api\Common\PermissionException::class,
120-
'8' => \Hopex\VkSdk\Exceptions\Api\Common\RequestException::class,
121-
'9' => \Hopex\VkSdk\Exceptions\Api\Common\FloodException::class,
122-
'10' => \Hopex\VkSdk\Exceptions\Api\Common\ServerException::class,
123-
'11' => \Hopex\VkSdk\Exceptions\Api\Common\EnabledInTestException::class,
124-
'14' => \Hopex\VkSdk\Exceptions\Api\Common\CaptchaException::class,
125-
'15' => \Hopex\VkSdk\Exceptions\Api\Accesses\AccessException::class,
126-
'16' => \Hopex\VkSdk\Exceptions\Api\Auth\AuthHttpsException::class,
127-
'17' => \Hopex\VkSdk\Exceptions\Api\Auth\AuthValidationException::class,
128-
'18' => \Hopex\VkSdk\Exceptions\Api\Common\UserDeletedException::class,
129-
'20' => \Hopex\VkSdk\Exceptions\Api\Methods\MethodPermissionException::class,
130-
'21' => \Hopex\VkSdk\Exceptions\Api\Methods\MethodAdsException::class,
131-
'23' => \Hopex\VkSdk\Exceptions\Api\Methods\MethodDisabledException::class,
132-
'24' => \Hopex\VkSdk\Exceptions\Api\Confirmation\NeedConfirmationException::class,
133-
'25' => \Hopex\VkSdk\Exceptions\Api\Confirmation\NeedTokenConfirmationException::class,
134-
'27' => \Hopex\VkSdk\Exceptions\Api\Groups\GroupAuthException::class,
135-
'28' => \Hopex\VkSdk\Exceptions\Api\Apps\AppAuthException::class,
136-
'29' => \Hopex\VkSdk\Exceptions\Api\Common\RateLimitException::class,
137-
'30' => \Hopex\VkSdk\Exceptions\Api\Common\PrivateProfileException::class,
138-
'100' => \Hopex\VkSdk\Exceptions\Api\Parameters\ParamException::class,
139-
'101' => \Hopex\VkSdk\Exceptions\Api\Parameters\ParamApiIdException::class,
140-
'113' => \Hopex\VkSdk\Exceptions\Api\Parameters\ParamUserIdException::class,
141-
'150' => \Hopex\VkSdk\Exceptions\Api\Parameters\ParamTimestampException::class,
142-
'200' => \Hopex\VkSdk\Exceptions\Api\Accesses\AccessAlbumException::class,
143-
'201' => \Hopex\VkSdk\Exceptions\Api\Accesses\AccessAudioException::class,
144-
'203' => \Hopex\VkSdk\Exceptions\Api\Accesses\AccessGroupException::class,
145-
'300' => \Hopex\VkSdk\Exceptions\Api\Albums\AlbumFullException::class,
146-
'500' => \Hopex\VkSdk\Exceptions\Api\Votes\VotesPermissionException::class,
147-
'600' => \Hopex\VkSdk\Exceptions\Api\Ads\AdsPermissionException::class,
148-
'603' => \Hopex\VkSdk\Exceptions\Api\Ads\AdsSpecificException::class,
149-
]
150195
];
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
return new class extends Migration {
8+
/**
9+
* @return void
10+
*/
11+
public function up(): void
12+
{
13+
Schema::create('vk_events', function (Blueprint $table) {
14+
$table->id();
15+
$table->unsignedBigInteger('group_id');
16+
$table->string('type');
17+
$table->string('event_id')->unique()->nullable();
18+
$table->timestamps();
19+
});
20+
}
21+
22+
/**
23+
* @return void
24+
*/
25+
public function down(): void
26+
{
27+
Schema::dropIfExists('vk_events');
28+
}
29+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
use Hopex\VkSdk\Models\Server;
4+
use Illuminate\Database\Migrations\Migration;
5+
use Illuminate\Database\Schema\Blueprint;
6+
use Illuminate\Support\Facades\Schema;
7+
8+
return new class extends Migration {
9+
/**
10+
* @return void
11+
*/
12+
public function up(): void
13+
{
14+
Schema::create('servers', function (Blueprint $table) {
15+
$table->id();
16+
$table->string('ip');
17+
$table->unsignedInteger('port');
18+
$table->string('rcon_password');
19+
$table->timestamps();
20+
});
21+
}
22+
23+
/**
24+
* @return void
25+
*/
26+
public function down(): void
27+
{
28+
Schema::dropIfExists('servers');
29+
}
30+
};

0 commit comments

Comments
 (0)