Skip to content
Merged

Dev #302

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
043e623
Add support for `crm.type` API in SDK, including methods for managing…
mesilov Oct 13, 2025
5ab4f7b
Add integration tests for `Type` service and implement `crm.type.upda…
mesilov Oct 13, 2025
d9093e9
Update CHANGELOG for version 1.8.0, documenting new `Services\CRM\Typ…
mesilov Oct 13, 2025
f098157
Merge pull request #276 from bitrix24/feature/274-add-crm-type-methods
mesilov Oct 13, 2025
13c4267
Fix incorrect array offset in `ItemsResult::getItems` and update CHAN…
mesilov Oct 15, 2025
423f988
Merge pull request #280 from bitrix24/bugfix/279-fix-crm-item-list
mesilov Oct 15, 2025
4ef7548
Add integration tests for `Item` service and implement `getSmartProce…
mesilov Oct 18, 2025
ea77548
Add `DeletedItemResult` and `UpdatedItemResult` classes, improve exce…
mesilov Oct 18, 2025
3ce75cf
Merge pull request #283 from bitrix24/feature/282-add-support-for-sma…
mesilov Oct 18, 2025
7c72174
Add `project` type to `PortalLicenseFamily` enum and update CHANGELOG…
mesilov Oct 29, 2025
e76b288
Merge pull request #287 from bitrix24/bugfix/286-fix-portal-family
mesilov Oct 29, 2025
5963716
Add support for CRM Contact events: `onCrmContactAdd`, `onCrmContactU…
mesilov Nov 2, 2025
a48aba9
Merge pull request #289 from bitrix24/feature/288-add-crm-on-contact-…
mesilov Nov 2, 2025
b0c7bcf
Refactor `RemoteEventsFactory`: add `create` and `validate` methods f…
mesilov Nov 3, 2025
3ba7938
Add unit tests for `RemoteEventsFactory`: include coverage for `creat…
mesilov Nov 3, 2025
19d4554
Merge pull request #292 from bitrix24/feature/291-split-create-event
mesilov Nov 3, 2025
af0ad57
Refactor `RemoteEventsFactory`: update `validate` method to use `Bitr…
mesilov Nov 3, 2025
0a3477a
Merge pull request #293 from bitrix24/feature/291-split-create-event
mesilov Nov 3, 2025
a2fbe68
Fix entity.get method
maximyugov Nov 4, 2025
9513251
Add unit tests for `UserAgentInfo` and `UTMs` classes, covering const…
mesilov Nov 4, 2025
8d8b48b
Merge pull request #296 from bitrix24/feature/290-fix-contact-person-…
mesilov Nov 4, 2025
7b9be9c
Add repository flusher integration in `ContactPersonRepositoryInterfa…
mesilov Nov 4, 2025
358b7c5
Merge pull request #297 from bitrix24/bugfix/294-fix-contact-person-r…
mesilov Nov 4, 2025
daa9cdc
Added info to changelog
maximyugov Nov 5, 2025
a1d1f07
Merge pull request #295 from maximyugov/bugfix/285-entity-get
mesilov Nov 7, 2025
2a0bafd
Remove deprecated `local-app-workflows` example application from repo…
mesilov Nov 8, 2025
a4d8225
Update to PHP 8.4 compatibility: refactor Rector configuration, Docke…
mesilov Nov 8, 2025
de520f8
Add new CRM Type methods to Bitrix24 PHP SDK documentation and adjust…
mesilov Nov 8, 2025
50e6acb
Make parameter types nullable across services to improve function fle…
mesilov Nov 8, 2025
48bab48
Add PHP 8.4 to GitHub workflows for CI/CD compatibility
mesilov Nov 8, 2025
f9acf45
Remove PHP 8.2 support, refactor tests and workflows, and align codeb…
mesilov Nov 8, 2025
91a4735
Update Rector cache path to `/var/.cache/rector` for alignment with n…
mesilov Nov 8, 2025
d386742
Merge pull request #298 from bitrix24/bugfix/277-fix-deprecated
mesilov Nov 8, 2025
7f41d19
Add `getEndpoints` method to `RenewedAuthToken` class for returning `…
mesilov Nov 8, 2025
c4d02c7
Add `DefaultOAuthServerUrl` class with methods for OAuth server URLs …
mesilov Nov 9, 2025
84f436c
Refactor Endpoints
mesilov Nov 9, 2025
8f13c2b
Refactor Credentials and Endpoints
mesilov Nov 9, 2025
4a692d3
Fix errors in Core after refactoring
mesilov Nov 9, 2025
e91b608
Refactor ServiceBuilderFactory with Endpoints support
mesilov Nov 9, 2025
e66eb43
Update tests for credentials
mesilov Nov 9, 2025
6b1c442
Update changelog
mesilov Nov 9, 2025
33ede01
Merge pull request #299 from bitrix24/bugfix/273-change-oauth-server-url
mesilov Nov 9, 2025
e99f647
Add protocol in Endpoints
mesilov Nov 9, 2025
cecf13e
Add protocol in Endpoints
mesilov Nov 9, 2025
63f36f4
Merge pull request #300 from bitrix24/bugfix/273-change-oauth-server-url
mesilov Nov 9, 2025
30a9958
New release update
mesilov Nov 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/license-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
dependencies: [ highest ]
operating-system: [ ubuntu-latest]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/php-cs-fixer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
dependencies: [ highest ]
operating-system: [ ubuntu-latest]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
dependencies: [ highest ]
operating-system: [ ubuntu-latest]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
dependencies: [ highest ]
operating-system: [ ubuntu-latest, windows-2022]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rector.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ jobs:
fail-fast: false
matrix:
php-version:
- "8.2"
- "8.3"
- "8.4"
dependencies: [ highest ]
operating-system: [ ubuntu-latest]

Expand Down
126 changes: 124 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,127 @@
# b24-php-sdk change log

## 1.8.0 - 2025.11.10

### Added

- Added service `Services\CRM\Type\Service\Type` with support methods,
see [crm.type.* methods](https://github.com/bitrix24/b24phpsdk/issues/274):
- `fields` method retrieves information about the custom fields of the smart process settings
- `add` method creates a new SPA
- `update` updates an existing SPA by its identifier id
- `get` method retrieves information about the SPA with the identifier id
- `getByEntityTypeId` method retrieves information about the SPA with the smart process type identifier entityTypeId
- `list` Get a list of custom types crm.type.list
- `delete` This method deletes an existing smart process by the identifier id
- For `AbstractCrmItem` added method `getSmartProcessItem` to get smart process item, [see details](https://github.com/bitrix24/b24phpsdk/issues/282)
- Added support for events, [see details](https://github.com/bitrix24/b24phpsdk/issues/288)
- `onCrmContactAdd`
- `onCrmContactUpdate`
- `onCrmContactDelete`
- Added separated methods `RemoteEventsFactory::create` and `RemoteEventsFactory::validate` for create and validate incoming
events, [see details](https://github.com/bitrix24/b24phpsdk/issues/291)
- Added comprehensive unit tests for `RemoteEventsFactory::create` and `RemoteEventsFactory::validate` methods with 14 test cases covering:
- Event creation for supported event types (CRM Contact Add, Application Install)
- Handling of unsupported events
- Request validation
- Token validation with `Bitrix24AccountInterface`
- Special handling for `OnApplicationInstall` events
- Updated `ContactPersonInterface` implementation, [see details](https://github.com/bitrix24/b24phpsdk/issues/290) with new methods:
- Added `isEmailVerified(): bool` to check email verification status
- Added `isMobilePhoneVerified(): bool` to check mobile phone verification status
- Changed `changeEmail(?string $email)` signature (removed optional `$isEmailVerified` parameter)
- Changed `changeMobilePhone(?PhoneNumber $phoneNumber)` signature (removed optional `$isMobilePhoneVerified` parameter)
- Added `getUserAgentInfo(): UserAgentInfo` to replace separate methods for user agent data
- Added comprehensive unit tests for `UTMs` class with 28 test cases covering:
- Constructor with all, partial, and default parameters
- URL parsing with various UTM parameter combinations
- Case-insensitive parameter handling
- URL encoding and special characters
- Real-world URL examples (Google Ads, Facebook, Email, Twitter, LinkedIn, etc.)
- Added comprehensive unit tests for `UserAgentInfo` class with 33 test cases covering:
- Constructor with IP addresses (IPv4, IPv6, localhost)
- Various user agent strings (Chrome, Firefox, Safari, Edge, mobile browsers)
- UTM extraction from referrer URLs
- Real-world scenarios with complete user tracking data
- Added support for dynamic OAuth server selection based on regional endpoints:
- `Credentials` class now supports `Endpoints` object with `authServerUrl` and `clientUrl`
- New methods in `Credentials`: `getEndpoints()`, `getOauthServerUrl()`, `getClientUrl()`,
`changeDomainUrl()`, [see details](https://github.com/bitrix24/b24phpsdk/issues/273)
- `Endpoints` class gained `changeClientUrl()` method to create new instance with updated client URL (immutable)
- `RenewedAuthToken` gained `getEndpoints()` method to create `Endpoints` object from server response
- `CoreBuilder` gained `withEndpoints()` and `withOauthServerUrl()` methods for explicit endpoint configuration
- OAuth server URL is automatically extracted from `server_endpoint` field in API responses
- Default OAuth server remains `https://oauth.bitrix.info` for backward compatibility
- Added comprehensive unit tests for `Endpoints` class with 29 test cases covering:
- Constructor validation for client and auth server URLs
- `getClientUrl()` and `getAuthServerUrl()` methods
- `changeClientUrl()` method with immutability checks
- `initFromArray()` static factory method with validation
- URL format validation (HTTP/HTTPS, ports, paths, subdomains)
- Error handling for invalid URLs and missing required fields
- Automatic addition of `https://` protocol when missing from client URL
- Added automatic protocol fallback in `Endpoints` constructor: if client URL is provided without protocol (e.g., `example.bitrix24.com`), `https://` is automatically added

### Changed

- **Breaking changes** in `ContactPersonInterface` method signatures:
- `changeEmail(?string $email)` - removed second parameter `?bool $isEmailVerified`. Migration path: call `markEmailAsVerified()` separately after
`changeEmail()` if email needs to be verified
- `changeMobilePhone(?PhoneNumber $phoneNumber)` - removed second parameter `?bool $isMobilePhoneVerified`. Migration path: call
`markMobilePhoneAsVerified()` separately after `changeMobilePhone()` if phone needs to be verified
- Replaced `getUserAgent()`, `getUserAgentReferer()`, `getUserAgentIp()` methods with single `getUserAgentInfo(): UserAgentInfo` method that returns
complete user agent information object. Migration path: use `$info->userAgent`, `$info->referrer`, `$info->ip` properties instead
- Updated `RemoteEventsFactory::validate()` method signature from `validate(EventInterface $event, string $applicationToken)` to
`validate(Bitrix24AccountInterface $bitrix24Account, EventInterface $event)`. Now uses `Bitrix24AccountInterface::isApplicationTokenValid()` for token
validation instead of direct string comparison
- **Docker configuration updated to PHP 8.4** - Development environment now uses PHP 8.4.14 (docker/php-cli/Dockerfile):
- Upgraded from PHP 8.3 to PHP 8.4 base image (`php:8.4-cli-bookworm`)
- Updated Composer to version 2.8
- Added PHP extension installer v2.4 from mlocati for easier extension management
- Added new PHP extensions: `amqp`, `excimer`, `opcache`, `pcntl`, `yaml`, `zip`
- Changed base OS from Alpine to Debian Bookworm for better compatibility
- Implemented multi-stage Docker build for optimized image size
- Added proper user/group ID mapping for www-data user (UID/GID 10001)
- Set proper working directory ownership and non-root user execution
- **PHP 8.4 compatibility improvements**:
- Rector configuration updated to use `LevelSetList::UP_TO_PHP_84` for PHP 8.4 feature detection
- PHPUnit configuration updated to PHPUnit 11.0 attribute set (`PHPUnitSetList::PHPUNIT_110`)
- Fixed all implicitly nullable parameter deprecation warnings (8 occurrences)
- Fixed PHPStan internal errors with `random_int()` range handling
- **OAuth server selection made dynamic**:
- `ApiClient` now uses `Credentials::getOauthServerUrl()` instead of hardcoded constant
- `Core` automatically updates endpoints in credentials when receiving renewed auth tokens
- OAuth server URL is preserved and updated from `server_endpoint` in token refresh responses
- Existing code continues to work without changes (backward compatible)

### Fixed

- Fixed wrong offset in `ItemsResult` [see details](https://github.com/bitrix24/b24phpsdk/issues/279)
- Fixed wrong exception for method `crm.item.get`, now it `ItemNotFoundException` [see details](https://github.com/bitrix24/b24phpsdk/issues/282)
- Fixed added type `project` in enum `PortalLicenseFamily` [see details](https://github.com/bitrix24/b24phpsdk/issues/286)
- Fixed errors in `ContactPersonRepositoryInterfaceTest`, [see details](https://github.com/bitrix24/b24phpsdk/issues/294)
- **Breaking change**: Fixed method signature `Credentials::createFromOAuth()` - third parameter changed from `string $domainUrl` to `Endpoints $endpoints`
object
- Migration: Replace `Credentials::createFromOAuth($authToken, $appProfile, 'https://example.com')` with
`Credentials::createFromOAuth($authToken, $appProfile, new Endpoints('https://example.com', 'https://oauth.bitrix.info/'))`
- Updated all unit and integration tests to use new signature
- Fixed bug in `Endpoints` class constructor (line 35) - validation should check `$this->authServerUrl` instead of `$authServerUrl` parameter
- Fixed unit tests in `CredentialsTest.php` to properly instantiate `Endpoints` objects
- Fixed unit tests in `CoreTest.php` integration test to use `Endpoints` object

### Deprecated

- Method `RemoteEventsFactory::createEvent` marked as deprecated, use `RemoteEventsFactory::create` and `RemoteEventsFactory::validate` instead

### Statistics

```
Bitrix24 API-methods count: 1162
Supported in bitrix24-php-sdk methods count: 639
Coverage percentage: 54.99% 🚀
Supported in bitrix24-php-sdk methods with batch wrapper count: 91
```

## 1.7.0 - 2025.10.08

### Added
Expand Down Expand Up @@ -207,6 +329,7 @@
- `list` retrieves a list of property bindings
- `deleteByFilter` removes the property relation
- `getFields` returns the available fields for property binding

### Fixed

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


## 1.6.0 – 2025.09.01

### Added
Expand Down Expand Up @@ -400,7 +522,6 @@ Supported in bitrix24-php-sdk methods count: 476
Coverage percentage: 41.03% 🚀
```


## 1.5.0 – 2025.08.01

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

<!--
### Deprecated
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ If You work on Windows:
- please use [WSL - Windows Subsystem for Linux](https://learn.microsoft.com/en-us/windows/wsl/)
- if your filesystem is NTFS, You can disable flag `git config --global core.protectNTFS false` for checkout folders started with dot.

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

## B24PhpSdk ✨FEATURES✨

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
"monolog/monolog": "^3",
"nyholm/psr7": "^1.8",
"openai-php/client": "0.10.*",
"phpstan/phpstan": "1.11.7",
"phpstan/phpstan": "^1",
"phpunit/phpunit": "^10 || ^11|| ^12",
"rector/rector": "^1",
"roave/security-advisories": "dev-master",
Expand Down
64 changes: 45 additions & 19 deletions docker/php-cli/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,53 @@
#FROM php:8.3-cli-alpine
#
#RUN apk add unzip libpq-dev git icu-dev \
# && docker-php-ext-install bcmath intl \
# && docker-php-ext-enable bcmath intl
# This file is part of the bitrix24-php-sdk package.
#
#RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/bin --filename=composer --quiet
# © Maksim Mesilov <mesilov.maxim@gmail.com>
#
#ENV COMPOSER_ALLOW_SUPERUSER 1
# For the full copyright and license information, please view the MIT-LICENSE.txt
# file that was distributed with this source code.
#

# Grab the PHP extension installer script from mlocati's image
# https://github.com/mlocati/docker-php-extension-installer#readme
FROM mlocati/php-extension-installer:2.4 AS php-extension-installer

# Separate Composer stage to install PHP dependencies efficiently
# https://hub.docker.com/_/composer
FROM composer:2.8 AS composer

# Using official PHP 8.3 CLI image based on Debian Bookworm for development purposes
FROM php:8.4-cli-bookworm AS dev-php

# Copy Composer binary from the official Composer image
COPY --from=composer /usr/bin/composer /usr/bin/composer
# Copy PHP extension installer script from mlocati's image
COPY --from=php-extension-installer /usr/bin/install-php-extensions /usr/bin/install-php-extensions

# Link to the source repository for this image (OCI standard label)
LABEL "org.opencontainers.image.source"="https://github.com/bitrix24/b24sdk-cli"

ARG UID=10001
ARG GID=10001

RUN <<EOF
groupmod --gid=${GID} www-data
usermod --uid=${UID} --gid=${GID} www-data
EOF

RUN <<EOF
apt-get update
apt-get install --no-install-recommends --no-install-suggests -q -y \
unzip
apt-get clean
rm -rf /var/lib/apt/lists/*
EOF

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

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

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

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

# Set Composer environment variable
ENV COMPOSER_ALLOW_SUPERUSER 1
ENV COMPOSER_CACHE_DIR=/tmp/composer/cache
Loading