Skip to content

Commit 165bf00

Browse files
authored
Merge pull request #302 from bitrix24/dev
Dev
2 parents 6933443 + 30a9958 commit 165bf00

File tree

91 files changed

+3639
-1233
lines changed

Some content is hidden

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

91 files changed

+3639
-1233
lines changed

.github/workflows/license-check.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
php-version:
15-
- "8.2"
1615
- "8.3"
16+
- "8.4"
1717
dependencies: [ highest ]
1818
operating-system: [ ubuntu-latest]
1919

.github/workflows/php-cs-fixer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
php-version:
15-
- "8.2"
1615
- "8.3"
16+
- "8.4"
1717
dependencies: [ highest ]
1818
operating-system: [ ubuntu-latest]
1919

.github/workflows/phpstan.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
php-version:
15-
- "8.2"
1615
- "8.3"
16+
- "8.4"
1717
dependencies: [ highest ]
1818
operating-system: [ ubuntu-latest]
1919

.github/workflows/phpunit.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
php-version:
19-
- "8.2"
2019
- "8.3"
20+
- "8.4"
2121
dependencies: [ highest ]
2222
operating-system: [ ubuntu-latest, windows-2022]
2323

.github/workflows/rector.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
php-version:
19-
- "8.2"
2019
- "8.3"
20+
- "8.4"
2121
dependencies: [ highest ]
2222
operating-system: [ ubuntu-latest]
2323

CHANGELOG.md

Lines changed: 124 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,127 @@
11
# b24-php-sdk change log
22

3+
## 1.8.0 - 2025.11.10
4+
5+
### Added
6+
7+
- Added service `Services\CRM\Type\Service\Type` with support methods,
8+
see [crm.type.* methods](https://github.com/bitrix24/b24phpsdk/issues/274):
9+
- `fields` method retrieves information about the custom fields of the smart process settings
10+
- `add` method creates a new SPA
11+
- `update` updates an existing SPA by its identifier id
12+
- `get` method retrieves information about the SPA with the identifier id
13+
- `getByEntityTypeId` method retrieves information about the SPA with the smart process type identifier entityTypeId
14+
- `list` Get a list of custom types crm.type.list
15+
- `delete` This method deletes an existing smart process by the identifier id
16+
- For `AbstractCrmItem` added method `getSmartProcessItem` to get smart process item, [see details](https://github.com/bitrix24/b24phpsdk/issues/282)
17+
- Added support for events, [see details](https://github.com/bitrix24/b24phpsdk/issues/288)
18+
- `onCrmContactAdd`
19+
- `onCrmContactUpdate`
20+
- `onCrmContactDelete`
21+
- Added separated methods `RemoteEventsFactory::create` and `RemoteEventsFactory::validate` for create and validate incoming
22+
events, [see details](https://github.com/bitrix24/b24phpsdk/issues/291)
23+
- Added comprehensive unit tests for `RemoteEventsFactory::create` and `RemoteEventsFactory::validate` methods with 14 test cases covering:
24+
- Event creation for supported event types (CRM Contact Add, Application Install)
25+
- Handling of unsupported events
26+
- Request validation
27+
- Token validation with `Bitrix24AccountInterface`
28+
- Special handling for `OnApplicationInstall` events
29+
- Updated `ContactPersonInterface` implementation, [see details](https://github.com/bitrix24/b24phpsdk/issues/290) with new methods:
30+
- Added `isEmailVerified(): bool` to check email verification status
31+
- Added `isMobilePhoneVerified(): bool` to check mobile phone verification status
32+
- Changed `changeEmail(?string $email)` signature (removed optional `$isEmailVerified` parameter)
33+
- Changed `changeMobilePhone(?PhoneNumber $phoneNumber)` signature (removed optional `$isMobilePhoneVerified` parameter)
34+
- Added `getUserAgentInfo(): UserAgentInfo` to replace separate methods for user agent data
35+
- Added comprehensive unit tests for `UTMs` class with 28 test cases covering:
36+
- Constructor with all, partial, and default parameters
37+
- URL parsing with various UTM parameter combinations
38+
- Case-insensitive parameter handling
39+
- URL encoding and special characters
40+
- Real-world URL examples (Google Ads, Facebook, Email, Twitter, LinkedIn, etc.)
41+
- Added comprehensive unit tests for `UserAgentInfo` class with 33 test cases covering:
42+
- Constructor with IP addresses (IPv4, IPv6, localhost)
43+
- Various user agent strings (Chrome, Firefox, Safari, Edge, mobile browsers)
44+
- UTM extraction from referrer URLs
45+
- Real-world scenarios with complete user tracking data
46+
- Added support for dynamic OAuth server selection based on regional endpoints:
47+
- `Credentials` class now supports `Endpoints` object with `authServerUrl` and `clientUrl`
48+
- New methods in `Credentials`: `getEndpoints()`, `getOauthServerUrl()`, `getClientUrl()`,
49+
`changeDomainUrl()`, [see details](https://github.com/bitrix24/b24phpsdk/issues/273)
50+
- `Endpoints` class gained `changeClientUrl()` method to create new instance with updated client URL (immutable)
51+
- `RenewedAuthToken` gained `getEndpoints()` method to create `Endpoints` object from server response
52+
- `CoreBuilder` gained `withEndpoints()` and `withOauthServerUrl()` methods for explicit endpoint configuration
53+
- OAuth server URL is automatically extracted from `server_endpoint` field in API responses
54+
- Default OAuth server remains `https://oauth.bitrix.info` for backward compatibility
55+
- Added comprehensive unit tests for `Endpoints` class with 29 test cases covering:
56+
- Constructor validation for client and auth server URLs
57+
- `getClientUrl()` and `getAuthServerUrl()` methods
58+
- `changeClientUrl()` method with immutability checks
59+
- `initFromArray()` static factory method with validation
60+
- URL format validation (HTTP/HTTPS, ports, paths, subdomains)
61+
- Error handling for invalid URLs and missing required fields
62+
- Automatic addition of `https://` protocol when missing from client URL
63+
- Added automatic protocol fallback in `Endpoints` constructor: if client URL is provided without protocol (e.g., `example.bitrix24.com`), `https://` is automatically added
64+
65+
### Changed
66+
67+
- **Breaking changes** in `ContactPersonInterface` method signatures:
68+
- `changeEmail(?string $email)` - removed second parameter `?bool $isEmailVerified`. Migration path: call `markEmailAsVerified()` separately after
69+
`changeEmail()` if email needs to be verified
70+
- `changeMobilePhone(?PhoneNumber $phoneNumber)` - removed second parameter `?bool $isMobilePhoneVerified`. Migration path: call
71+
`markMobilePhoneAsVerified()` separately after `changeMobilePhone()` if phone needs to be verified
72+
- Replaced `getUserAgent()`, `getUserAgentReferer()`, `getUserAgentIp()` methods with single `getUserAgentInfo(): UserAgentInfo` method that returns
73+
complete user agent information object. Migration path: use `$info->userAgent`, `$info->referrer`, `$info->ip` properties instead
74+
- Updated `RemoteEventsFactory::validate()` method signature from `validate(EventInterface $event, string $applicationToken)` to
75+
`validate(Bitrix24AccountInterface $bitrix24Account, EventInterface $event)`. Now uses `Bitrix24AccountInterface::isApplicationTokenValid()` for token
76+
validation instead of direct string comparison
77+
- **Docker configuration updated to PHP 8.4** - Development environment now uses PHP 8.4.14 (docker/php-cli/Dockerfile):
78+
- Upgraded from PHP 8.3 to PHP 8.4 base image (`php:8.4-cli-bookworm`)
79+
- Updated Composer to version 2.8
80+
- Added PHP extension installer v2.4 from mlocati for easier extension management
81+
- Added new PHP extensions: `amqp`, `excimer`, `opcache`, `pcntl`, `yaml`, `zip`
82+
- Changed base OS from Alpine to Debian Bookworm for better compatibility
83+
- Implemented multi-stage Docker build for optimized image size
84+
- Added proper user/group ID mapping for www-data user (UID/GID 10001)
85+
- Set proper working directory ownership and non-root user execution
86+
- **PHP 8.4 compatibility improvements**:
87+
- Rector configuration updated to use `LevelSetList::UP_TO_PHP_84` for PHP 8.4 feature detection
88+
- PHPUnit configuration updated to PHPUnit 11.0 attribute set (`PHPUnitSetList::PHPUNIT_110`)
89+
- Fixed all implicitly nullable parameter deprecation warnings (8 occurrences)
90+
- Fixed PHPStan internal errors with `random_int()` range handling
91+
- **OAuth server selection made dynamic**:
92+
- `ApiClient` now uses `Credentials::getOauthServerUrl()` instead of hardcoded constant
93+
- `Core` automatically updates endpoints in credentials when receiving renewed auth tokens
94+
- OAuth server URL is preserved and updated from `server_endpoint` in token refresh responses
95+
- Existing code continues to work without changes (backward compatible)
96+
97+
### Fixed
98+
99+
- Fixed wrong offset in `ItemsResult` [see details](https://github.com/bitrix24/b24phpsdk/issues/279)
100+
- Fixed wrong exception for method `crm.item.get`, now it `ItemNotFoundException` [see details](https://github.com/bitrix24/b24phpsdk/issues/282)
101+
- Fixed added type `project` in enum `PortalLicenseFamily` [see details](https://github.com/bitrix24/b24phpsdk/issues/286)
102+
- Fixed errors in `ContactPersonRepositoryInterfaceTest`, [see details](https://github.com/bitrix24/b24phpsdk/issues/294)
103+
- **Breaking change**: Fixed method signature `Credentials::createFromOAuth()` - third parameter changed from `string $domainUrl` to `Endpoints $endpoints`
104+
object
105+
- Migration: Replace `Credentials::createFromOAuth($authToken, $appProfile, 'https://example.com')` with
106+
`Credentials::createFromOAuth($authToken, $appProfile, new Endpoints('https://example.com', 'https://oauth.bitrix.info/'))`
107+
- Updated all unit and integration tests to use new signature
108+
- Fixed bug in `Endpoints` class constructor (line 35) - validation should check `$this->authServerUrl` instead of `$authServerUrl` parameter
109+
- Fixed unit tests in `CredentialsTest.php` to properly instantiate `Endpoints` objects
110+
- Fixed unit tests in `CoreTest.php` integration test to use `Endpoints` object
111+
112+
### Deprecated
113+
114+
- Method `RemoteEventsFactory::createEvent` marked as deprecated, use `RemoteEventsFactory::create` and `RemoteEventsFactory::validate` instead
115+
116+
### Statistics
117+
118+
```
119+
Bitrix24 API-methods count: 1162
120+
Supported in bitrix24-php-sdk methods count: 639
121+
Coverage percentage: 54.99% 🚀
122+
Supported in bitrix24-php-sdk methods with batch wrapper count: 91
123+
```
124+
3125
## 1.7.0 - 2025.10.08
4126

5127
### Added
@@ -207,6 +329,7 @@
207329
- `list` retrieves a list of property bindings
208330
- `deleteByFilter` removes the property relation
209331
- `getFields` returns the available fields for property binding
332+
210333
### Fixed
211334

212335
- Fixed Incorrect data loading in `Core\Batch::getTraversableList()` with desc sorting by ID [see details](https://github.com/bitrix24/b24phpsdk/issues/246)
@@ -219,7 +342,6 @@ Supported in bitrix24-php-sdk methods count: 632
219342
Coverage percentage: 54.39% 🚀
220343
```
221344

222-
223345
## 1.6.0 – 2025.09.01
224346

225347
### Added
@@ -400,7 +522,6 @@ Supported in bitrix24-php-sdk methods count: 476
400522
Coverage percentage: 41.03% 🚀
401523
```
402524

403-
404525
## 1.5.0 – 2025.08.01
405526

406527
### Added
@@ -1060,6 +1181,7 @@ Supported in bitrix24-php-sdk methods with batch wrapper count: 22
10601181
- Fixed variable names in `Bitrix24\SDK\Services\ServiceBuilderFactory::initFromRequest`,
10611182
see [wrong variable name](https://github.com/bitrix24/b24phpsdk/issues/30).
10621183
- Fixed some corner cases in `Bitrix24\SDK\Core\ApiLevelErrorHandler`
1184+
- Fixed getting entity by its code, see [entity.get issue](https://github.com/bitrix24/b24phpsdk/issues/285)
10631185

10641186
<!--
10651187
### Deprecated

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ If You work on Windows:
2828
- please use [WSL - Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/)
2929
- if your filesystem is NTFS, You can disable flag `git config --global core.protectNTFS false` for checkout folders started with dot.
3030

31-
Or add `"bitrix24/b24phpsdk": "1.7.*"` to `composer.json` of your application.
31+
Or add `"bitrix24/b24phpsdk": "1.8.*"` to `composer.json` of your application.
3232

3333
## B24PhpSdk ✨FEATURES✨
3434

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
"monolog/monolog": "^3",
5656
"nyholm/psr7": "^1.8",
5757
"openai-php/client": "0.10.*",
58-
"phpstan/phpstan": "1.11.7",
58+
"phpstan/phpstan": "^1",
5959
"phpunit/phpunit": "^10 || ^11|| ^12",
6060
"rector/rector": "^1",
6161
"roave/security-advisories": "dev-master",

docker/php-cli/Dockerfile

Lines changed: 45 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,53 @@
1-
#FROM php:8.3-cli-alpine
21
#
3-
#RUN apk add unzip libpq-dev git icu-dev \
4-
# && docker-php-ext-install bcmath intl \
5-
# && docker-php-ext-enable bcmath intl
2+
# This file is part of the bitrix24-php-sdk package.
63
#
7-
#RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin --filename=composer --quiet
4+
# © Maksim Mesilov <[email protected]>
85
#
9-
#ENV COMPOSER_ALLOW_SUPERUSER 1
6+
# For the full copyright and license information, please view the MIT-LICENSE.txt
7+
# file that was distributed with this source code.
8+
#
9+
10+
# Grab the PHP extension installer script from mlocati's image
11+
# https://github.com/mlocati/docker-php-extension-installer#readme
12+
FROM mlocati/php-extension-installer:2.4 AS php-extension-installer
13+
14+
# Separate Composer stage to install PHP dependencies efficiently
15+
# https://hub.docker.com/_/composer
16+
FROM composer:2.8 AS composer
17+
18+
# Using official PHP 8.3 CLI image based on Debian Bookworm for development purposes
19+
FROM php:8.4-cli-bookworm AS dev-php
20+
21+
# Copy Composer binary from the official Composer image
22+
COPY --from=composer /usr/bin/composer /usr/bin/composer
23+
# Copy PHP extension installer script from mlocati's image
24+
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions
25+
26+
# Link to the source repository for this image (OCI standard label)
27+
LABEL "org.opencontainers.image.source"="https://github.com/bitrix24/b24sdk-cli"
28+
29+
ARG UID=10001
30+
ARG GID=10001
31+
32+
RUN <<EOF
33+
groupmod --gid=${GID} www-data
34+
usermod --uid=${UID} --gid=${GID} www-data
35+
EOF
36+
37+
RUN <<EOF
38+
apt-get update
39+
apt-get install --no-install-recommends --no-install-suggests -q -y \
40+
unzip
41+
apt-get clean
42+
rm -rf /var/lib/apt/lists/*
43+
EOF
1044

11-
FROM php:8.3-cli-alpine
45+
RUN install-php-extensions bcmath excimer intl pcntl opcache yaml zip
1246

13-
# Install system dependencies and PHP extensions
14-
RUN apk add --no-cache unzip libpq-dev git icu-dev $PHPIZE_DEPS \
15-
&& docker-php-ext-install bcmath intl \
16-
&& docker-php-ext-enable bcmath intl
47+
WORKDIR /var/www/html
1748

18-
# Install and enable Excimer extension
19-
# https://www.mediawiki.org/wiki/Excimer
20-
RUN pecl install excimer \
21-
&& docker-php-ext-enable excimer
49+
RUN chown www-data:www-data /var/www/html
2250

23-
# Install Composer
24-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin --filename=composer --quiet
51+
USER www-data
2552

26-
# Set Composer environment variable
27-
ENV COMPOSER_ALLOW_SUPERUSER 1
53+
ENV COMPOSER_CACHE_DIR=/tmp/composer/cache

0 commit comments

Comments
 (0)