Skip to content
This repository was archived by the owner on Feb 7, 2025. It is now read-only.

Commit 888c4a1

Browse files
authored
Merge pull request #309 from mesilov/dev
v2.alpha.7
2 parents 59905b0 + 3773768 commit 888c4a1

File tree

204 files changed

+8831
-630
lines changed

Some content is hidden

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

204 files changed

+8831
-630
lines changed

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
custom: ["https://boosty.to/bitrix24-php-sdk"]

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.idea*
2+
/app
23
vendor
34
composer.phar
45
composer.lock

CHANGELOG.md

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,71 @@
11
# bitrix24-php-sdk change log
22

3-
## 2.0-alpha.6 — 7.02.2021
3+
## 2.0-alpha.7 — 8.08.2022
4+
5+
### Added
6+
7+
* add new scope `Telephony` and services [add Telephony support](https://github.com/mesilov/bitrix24-php-sdk/issues/291)
8+
* add new scope `UserConsent` and services [add UserConsent support](https://github.com/mesilov/bitrix24-php-sdk/issues/285)
9+
* add new scope `Placements` and services [add Placements support](https://github.com/mesilov/bitrix24-php-sdk/issues/274)
10+
* add new scope `IMOpenLines` and services [add IM Open Lines support](https://github.com/mesilov/bitrix24-php-sdk/issues/302)
11+
* add in scope `CRM` new service `Leads` in scope «CRM» [add Leads support](https://github.com/mesilov/bitrix24-php-sdk/issues/282)
12+
* add in scope `CRM` new service `Activity` in scope «CRM» [add Activity support](https://github.com/mesilov/bitrix24-php-sdk/issues/283)
13+
* add in scope `CRM` for entity Deal method `Services\CRM\Deal\Service\Batch::update` batch update deals
14+
* add in scope `CRM` for entity Contact method `Services\CRM\Contact\Service\Batch::delete` batch delete contacts
15+
* add in scope `CRM` [read models](https://github.com/mesilov/bitrix24-php-sdk/issues/300) for activity `Services\CRM\Activity\ReadModel`
16+
for activity types: `EmailFetcher`, `OpenLineFetcher`, `VoximplantFetcher`, `WebFormFetcher`
17+
* add in scope «Main» new service `Events` [add incoming events support](https://github.com/mesilov/bitrix24-php-sdk/issues/296)
18+
* add support Application level events: `ONAPPINSTALL`
19+
and `ONAPPUNINSTALL` [add incoming events support](https://github.com/mesilov/bitrix24-php-sdk/issues/296)
20+
* add support Application level event: `PortalDomainUrlChangedEvent`
21+
* add method `Core\Batch::updateEntityItems` for [update items in batch mode](https://github.com/mesilov/bitrix24-php-sdk/issues/268) and
22+
integration test
23+
* add method to interface `Core\Contracts\BatchInterface::updateEntityItems` for update items in batch mode
24+
* add in scope `Placements` service `Placement\Service\UserFieldType` for work with user fields embedding
25+
* add in scope `Telephony` add events: `OnExternalCallBackStart`, `OnExternalCallStart`, `OnVoximplantCallEnd`, `OnVoximplantCallEnd`
26+
, `OnVoximplantCallInit`, `OnVoximplantCallStart` see [add telephony events](https://github.com/mesilov/bitrix24-php-sdk/issues/304)
27+
* add `ApplicationStatus` with application status codes description
28+
* add fabric method `AccessToken::initFromPlacementRequest` when application init form placement request
29+
* add fabric method `ApplicationProfile::initFromArray` when application profile stored in ENV-variables
30+
* add `Bitrix24\SDK\Application\Requests\Placement\PlacementRequest` for application data from placements
31+
* add fabric method `Credentials::initFromPlacementRequest` when application init form placement request
32+
* add method `Services\Main\Service::getServerTime` returns current server time in the format YYYY-MM-DDThh:mm:ss±hh:mm.
33+
* add method `Services\Main\Service::getCurrentUserProfile` return basic Information about the current user without any scopes
34+
* add method `Services\Main\Service::getAccessName` returns access permission names.
35+
* add method `Services\Main\Service::checkUserAccess` Checks if the current user has at least one permission of those specified by the
36+
ACCESS parameter.
37+
* add method `Services\Main\Service::getMethodAffordability` Method returns 2 parameters - isExisting and isAvailable
38+
* add money type support by [phpmoney](https://github.com/moneyphp/money)
39+
* add support fields `operating` and `operating_reset_at` at `Bitrix24\SDK\Core\Response\DTO\Time` datastructures
40+
41+
### Changed
42+
43+
* update scope list [расширить и актуализировать доступные скоупы](https://github.com/mesilov/bitrix24-php-sdk/issues/280)
44+
* bump `symfony/*` to `6.*` version requirement.
45+
* method `Services\Main\Service::getAvailableMethods` marks as deprecated
46+
* method `Services\Main\Service::getAllMethods` marks as deprecated
47+
* method `Services\Main\Service::getMethodsByScope` marks as deprecated
48+
* ❗️fabric methods `Bitrix24\SDK\Core\Credentials`
49+
renamed and now are [consistent](https://github.com/mesilov/bitrix24-php-sdk/issues/303): `createFromWebhook`, `createFromOAuth`
50+
, `createFromPlacementRequest`
51+
* ❗️deleted [unused class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `Bitrix24\SDK\Core\Response\DTO\ResponseDataCollection`
52+
* ❗️deleted [redundant class](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `Bitrix24\SDK\Core\Response\DTO\Result`
53+
* ❗️deleted [method](https://github.com/mesilov/bitrix24-php-sdk/issues/303) `CoreBuilder::withWebhookUrl`, use
54+
method `CoreBuilder::withCredentials`
55+
56+
### Bugfix
57+
58+
* add bugfix for batch method for reverse order queries
59+
* fix type compatible errors for `Core\Result\AbstractItem`
60+
* fix error in `NetworkTimingParser`, [error in NetworkTimingsErrorInfo](https://github.com/mesilov/bitrix24-php-sdk/issues/277)
61+
* fix error in `RenewedAccessToken` DTO, remove `Scope`
62+
enum [UnknownScopeCodeException - in refresh token response](https://github.com/mesilov/bitrix24-php-sdk/issues/295)
63+
64+
### etc
65+
66+
* add link to [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk) for sponsoring development
67+
68+
## 2.0-alpha.6 — 7.02.2022
469

570
### Added
671

CONTRIBUTING.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# A quick guide to contribute to the project:
2+
3+
## Installing the dev environment
4+
5+
1. Fork the repo
6+
2. Clone the repo to local
7+
3. Install dependencies: `composer update` (this assumes you have 'composer' aliased to wherever your composer.phar lives)
8+
4. Run the tests. We only take pull requests with passing tests, and it's great to know that you have a clean slate:
9+
`composer phpstan-analyse`
10+
`composer phpunit-run-unit-tests`
11+
`composer phpunit-run-integration-tests`
12+
13+
## Adding new features
14+
15+
Pull requests with new features needs to be created against master branch.
16+
17+
If new feature require BC Break please note that in your PR comment, it will added in next major version.
18+
New features that does not have any BC Breaks are going to be added in next minor version.
19+
20+
## Codding standards
21+
22+
In order to fix codding standards please exeecute:
23+
24+
```shell
25+
composer phpstan-analyse
26+
```
27+
28+
## Patches and bugfixes
29+
30+
1. Check the oldest version that patch/bug fix can be applied.
31+
2. Create PR against that version
32+
33+
34+
## The actual contribution
35+
36+
1. Make the changes/additions to the code, committing often and making clear what you've done
37+
2. Make sure you write tests for your code, located in the folder structure
38+
3. Run your tests (often and while coding)
39+
4. Create Pull Request on github to against proper branch

MIT-LICENSE.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Copyright 2013 Mesilov Maxim
2-
https://bitrixinsider.ru/
1+
Copyright 2022 Maxim Mesilov
32

43
Permission is hereby granted, free of charge, to any person obtaining
54
a copy of this software and associated documentation files (the

README.md

Lines changed: 60 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ Performance improvements 🚀
7373
- test coverage: unit, integration, contract
7474
- typical examples typical for different modes of operation and they are optimized for memory \ performance
7575

76+
### Sponsors
77+
78+
Help bitrix24-php-sdk by [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk) its development!
79+
7680
### Architecture
7781

7882
### Abstraction layers
@@ -121,7 +125,8 @@ Add `"mesilov/bitrix24-php-sdk": "2.x"` to `composer.json` of your application.
121125

122126
### Tests
123127

124-
Tests locate in folder `tests` and we have two test types
128+
Tests locate in folder `tests` and we have two test types.
129+
In folder tests create file `.env.local` and fill environment variables from `.env`.
125130

126131
#### Unit tests
127132

@@ -184,7 +189,6 @@ See also the list of [contributors](https://github.com/mesilov/bitrix24-php-sdk/
184189

185190
email: <mesilov.maxim@gmail.com>
186191

187-
### Sponsors
188192

189193
### Documentation
190194

@@ -217,6 +221,10 @@ email: <mesilov.maxim@gmail.com>
217221
- покрытие тестами: unit, интеграционные, контрактные
218222
- есть типовые примеры характерные для разных режимов работы и они оптимизированы по памяти \ быстродействию
219223

224+
### Спонсоры
225+
226+
Помогите развитию bitrix24-php-sdk подписавшись на [boosty.to/bitrix24-php-sdk](https://boosty.to/bitrix24-php-sdk)!
227+
220228
### Ключевые особенности
221229

222230
### Слои SDK
@@ -331,4 +339,53 @@ Symfony HttpClient
331339

332340
JSON по HTTP/2 или HTTP/1.1
333341

334-
## Спонсоры
342+
## Спонсоры
343+
344+
### Тесты
345+
346+
Тесты расположены в папке `tests` и бывают двух типов: юнит и интеграционные.
347+
В папке `tests` создайте файл `.env.local` и заполните переменные из файла `.env`.
348+
349+
#### Юнит тесты
350+
351+
**Быстрые**, выполняются без сетевого взаимодействия с Битрикс 24.
352+
353+
```shell
354+
composer phpunit-run-unit-test
355+
```
356+
357+
#### Интеграционные тесты
358+
359+
**Медленные** тесты покрывают полный жизненный цикл CRUD операций подключение к Битрикс 24 происходи с помощью веб-хука.
360+
361+
❗ Не запускайте интеграционные тесты на ваших production порталах они удалят все ваши данные ❗️
362+
363+
Для запуска интеграционных тестов вам нужно:
364+
365+
1. Создать [Новый портал Битрикс 24](https://www.bitrix24.ru/create.php?p=255670) для запуска тестов.
366+
2. Перейти в левое меню и нажать "Карта сайта".
367+
3. Найти меню для "Разработчиков"
368+
4. Кликнуть в меню «Другое»
369+
5. Кликнуть в меню «Входящий веб-хук»
370+
6. Выбрать все нужные расширения и нажать кнопку "сохранить".
371+
7. Создать файл `/tests/.env.local` с переменными окружения которые скопировать из файла `/tests/.env` .
372+
373+
```yaml
374+
APP_ENV=dev
375+
BITRIX24_WEBHOOK=https:// your portal webhook url
376+
INTEGRATION_TEST_LOG_LEVEL=500
377+
```
378+
379+
8. Запуск из командной строки.
380+
381+
```shell
382+
composer composer phpunit-run-integration-tests
383+
```
384+
385+
#### Статический анализ кодовой базы – phpstan
386+
387+
Запуск из командной строки.
388+
389+
```shell
390+
composer phpstan-analyse
391+
```

composer.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,27 @@
1919
"require": {
2020
"php": "7.4.*|8.*",
2121
"ext-json": "*",
22+
"ext-bcmath": "*",
2223
"ext-curl": "*",
2324
"psr/log": "^1.1.4 || ^2.0 || ^3.0",
2425
"fig/http-message-util": "1.1.*",
25-
"symfony/http-client": "5.4.*",
26-
"symfony/http-client-contracts": "^2.5",
27-
"symfony/event-dispatcher": "5.4.*",
28-
"ramsey/uuid": "^4.2.3"
26+
"symfony/http-client": "5.4.* || 6.*",
27+
"symfony/http-client-contracts": "^2.5 || ^3.1",
28+
"symfony/http-foundation": "5.4.* || 6.*",
29+
"symfony/event-dispatcher": "5.4.* || 6.*",
30+
"ramsey/uuid": "^4.2.3",
31+
"moneyphp/money": "3.* || 4.*"
2932
},
3033
"require-dev": {
3134
"monolog/monolog": "2.1.*",
32-
"symfony/console": "5.4.*",
33-
"symfony/dotenv": "5.4.*",
34-
"symfony/debug-bundle": "5.4.*",
35-
"phpstan/phpstan": "1.1.*",
35+
"symfony/console": "5.4.* || 6.*",
36+
"symfony/dotenv": "5.4.* || 6.*",
37+
"symfony/debug-bundle": "5.4.* || 6.*",
38+
"phpstan/phpstan": "1.*",
3639
"phpunit/phpunit": "9.5.*",
37-
"symfony/stopwatch": "5.4.*",
38-
"roave/security-advisories": "dev-master"
40+
"symfony/stopwatch": "5.4.* || 6.*",
41+
"roave/security-advisories": "dev-master",
42+
"ext-intl": "*"
3943
},
4044
"autoload": {
4145
"psr-4": {
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Создание Локального приложения
2+
## Предусловия
3+
1. Создайте 2 файла в корне рабочей папки например app: это `install.php` и `index.php`.
4+
2. Содержимое файла `install.php`.
5+
```php
6+
```
7+
3. Для работы локального серверного приложения требуется рабочий веб сервер на машине разработчика.
8+
4. Запускаем локальный веб-сервер, например так:
9+
```shell
10+
php -S 127.0.0.1:8080
11+
```
12+
3. Пробрасываем порт в большой интернет через сервис ngrok.
13+
```shell
14+
ngrok http 127.0.0.1:8080
15+
```
16+
4. После запуска ngrok будет выдан временный публичный адрес типо `https://7949-178-34-183-66.eu.ngrok.io`, который после выключения сервиса перестанет существовать. Этот адрес исчезнет после завершения ngrok.
17+
5. Зарегистрируйте новый портал битрикс 24.
18+
6. Включите тестовый период для маркет плейса и тарифного плана.
19+
7. Открой портал и перейдите в меню.
20+
1. Откройте левое меню, выберите "Разработчикам"
21+
2. Выберите "Другое"
22+
3. Откройте "Локальное приложение"
23+
4. Зарегистрируйте новое локальное приложение с нужным вам скоупом.

docs/RU/Core/Auth/auth.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ $result = json_decode($result->getContent(), true);
3737
var_dump($result);
3838
```
3939

40-
## подключение к Битрикс24 с использованием OAuth 2.0
40+
## подключение к Битрикс24 с использованием OAuth 2.0
4141

4242
```php
4343
<?php
@@ -71,7 +71,7 @@ $token = new \Bitrix24\SDK\Core\Credentials\AccessToken(
7171
1604179882
7272
);
7373
$domain = 'https:// client portal address .bitrix24.ru';
74-
$credentials = \Bitrix24\SDK\Core\Credentials\Credentials::createForOAuth($token, $appProfile, $domain);
74+
$credentials = \Bitrix24\SDK\Core\Credentials\Credentials::createFromOAuth($token, $appProfile, $domain);
7575

7676
$apiClient = new \Bitrix24\SDK\Core\ApiClient($credentials, $traceableClient, $log);
7777
$app = new \Bitrix24\SDK\Services\Main($apiClient, $log);

0 commit comments

Comments
 (0)