Skip to content

Commit d37c907

Browse files
committed
Add support for php 8.3 and librdkafka 2.1.0, 2.1.1, 2.2.0, 2.3.0
1 parent 18d49e2 commit d37c907

File tree

21 files changed

+6062
-655
lines changed

21 files changed

+6062
-655
lines changed

.ffigen.yml

+2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ headerFiles:
33
- rdkafka_mock.h
44
headerSearchPaths:
55
- resources/ffigen/tmp
6+
- /usr/include/aarch64-linux-gnu
7+
- /opt/homebrew/include
68
libraryFile: librdkafka.so.1
79
generatorClass: RdKafka\FFIGen\MultiVersionGenerator
810
outputPath: resources/ffigen/tmp

.github/workflows/test-macos.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
fail-fast: true
1313
matrix:
1414
php:
15-
- '8.0'
1615
- '8.1'
1716
- '8.2'
17+
- '8.3'
1818
defaults:
1919
run:
2020
shell: bash

.github/workflows/test-windows.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ jobs:
1212
fail-fast: true
1313
matrix:
1414
php:
15-
- '8.0'
1615
- '8.1'
1716
- '8.2'
17+
- '8.3'
1818
librdkafka:
19-
- '2.0.2'
19+
- '2.3.0'
2020
defaults:
2121
run:
2222
shell: bash
@@ -35,9 +35,9 @@ jobs:
3535
run: |
3636
nuget install librdkafka.redist -Version ${{ matrix.librdkafka }}
3737
choco install --no-progress wget nssm
38-
wget -q -O kafka_2.13-3.3.2.tgz http://ftp.fau.de/apache/kafka/3.3.2/kafka_2.13-3.3.2.tgz
39-
tar -xzf kafka_2.13-3.3.2.tgz
40-
cp -pr kafka_2.13-3.3.2 /c/kafka
38+
wget -q -O kafka_2.13-3.6.1.tgz http://ftp.fau.de/apache/kafka/3.6.1/kafka_2.13-3.6.1.tgz
39+
tar -xzf kafka_2.13-3.6.1.tgz
40+
cp -pr kafka_2.13-3.6.1 /c/kafka
4141
sed -i "s|broker.id=0|broker.id=111|g" /c/kafka/config/server.properties
4242
nssm install zookeeper /c/kafka/bin/windows/zookeeper-server-start.bat /c/kafka/config/zookeeper.properties
4343
nssm set zookeeper AppExit Default Exit

.github/workflows/test.yml

+10-6
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,23 @@ jobs:
1212
fail-fast: false
1313
matrix:
1414
include:
15-
- php: '8.0'
16-
librdkafka: 'v2.0.2'
15+
- php: '8.1'
16+
librdkafka: 'v2.3.0'
1717
publish: true
1818
exclude:
19-
- php: '8.0'
20-
librdkafka: 'v2.0.2'
19+
- php: '8.1'
20+
librdkafka: 'v2.3.0'
2121
publish: false
2222
php:
2323
- '7.4'
2424
- '8.0'
2525
- '8.1'
2626
- '8.2'
27+
- '8.3'
2728
librdkafka:
29+
- 'v2.3.0'
30+
- 'v2.2.0'
31+
- 'v2.1.1'
2832
- 'v2.0.2'
2933
- 'v1.9.2'
3034
- 'v1.8.2'
@@ -42,14 +46,14 @@ jobs:
4246
continue-on-error: ${{ matrix.librdkafka == 'master' }}
4347
services:
4448
zookeeper:
45-
image: confluentinc/cp-zookeeper:7.3.1
49+
image: confluentinc/cp-zookeeper:7.5.2
4650
ports:
4751
- 2181:2181
4852
env:
4953
ZOOKEEPER_CLIENT_PORT: 2181
5054
ZOOKEEPER_TICK_TIME: 2000
5155
kafka:
52-
image: confluentinc/cp-kafka:7.3.1
56+
image: confluentinc/cp-kafka:7.5.2
5357
ports:
5458
- 9092:9092
5559
env:

docker-compose.yml

+13-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ networks:
55

66
services:
77
zookeeper:
8-
image: confluentinc/cp-zookeeper:7.3.1
8+
image: confluentinc/cp-zookeeper:7.5.2
99
ports:
1010
- 2181:2181
1111
environment:
@@ -15,7 +15,7 @@ services:
1515
- php-rdkafka-ffi
1616

1717
kafka:
18-
image: confluentinc/cp-kafka:7.3.1
18+
image: confluentinc/cp-kafka:7.5.2
1919
ports:
2020
- 9092:9092
2121
hostname: kafka
@@ -90,6 +90,17 @@ services:
9090
networks:
9191
- php-rdkafka-ffi
9292

93+
php83:
94+
build:
95+
context: resources/docker/php83-librdkafka-ffi
96+
image: php83-librdkafka-ffi:latest
97+
volumes:
98+
- .:/app
99+
depends_on:
100+
- kafka
101+
networks:
102+
- php-rdkafka-ffi
103+
93104
mkdocs:
94105
build:
95106
context: resources/docker/mkdocs-material

resources/docker/php74-librdkafka-ffi/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
FROM php:7.4-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.0.2
4+
ARG LIBRDKAFKA_VERSION=v2.3.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \

resources/docker/php80-librdkafka-ffi/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM php:8.0-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.0.2
4+
ARG LIBRDKAFKA_VERSION=v2.3.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \
8-
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev; \
8+
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev libc6-dev; \
99
docker-php-ext-configure ffi; \
1010
docker-php-ext-install -j$(nproc) ffi pcntl; \
1111
git clone --branch "${LIBRDKAFKA_VERSION}" --depth 1 https://github.com/confluentinc/librdkafka.git /tmp/librdkafka; \

resources/docker/php81-librdkafka-ffi/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM php:8.1-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.0.2
4+
ARG LIBRDKAFKA_VERSION=v2.3.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \
8-
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev; \
8+
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev libc6-dev; \
99
docker-php-ext-configure ffi; \
1010
docker-php-ext-install -j$(nproc) ffi pcntl; \
1111
git clone --branch "${LIBRDKAFKA_VERSION}" --depth 1 https://github.com/confluentinc/librdkafka.git /tmp/librdkafka; \
@@ -33,6 +33,8 @@ RUN git clone --branch "$RDKAFKA_EXT_VERSION" --depth 1 https://github.com/arnau
3333
make install; \
3434
rm -rf /tmp/*;
3535

36+
RUN apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev libc6-dev;
37+
3638
ENV COMPOSER_HOME /tmp
3739
ENV COMPOSER_ALLOW_SUPERUSER 1
3840
COPY --from=composer /usr/bin/composer /usr/bin/composer

resources/docker/php82-librdkafka-ffi/Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
FROM php:8.2-cli
22

33
# enable ffi and install librdkafka
4-
ARG LIBRDKAFKA_VERSION=v2.0.2
4+
ARG LIBRDKAFKA_VERSION=v2.3.0
55
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
66
RUN set -e; \
77
apt-get update; \
8-
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev; \
8+
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev libc6-dev; \
99
docker-php-ext-configure ffi; \
1010
docker-php-ext-install -j$(nproc) ffi pcntl; \
1111
git clone --branch "${LIBRDKAFKA_VERSION}" --depth 1 https://github.com/confluentinc/librdkafka.git /tmp/librdkafka; \
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
FROM php:8.3-cli
2+
3+
# enable ffi and install librdkafka
4+
ARG LIBRDKAFKA_VERSION=v2.3.0
5+
ENV LIBRDKAFKA_VERSION=$LIBRDKAFKA_VERSION
6+
RUN set -e; \
7+
apt-get update; \
8+
apt-get install -y --no-install-recommends git zip unzip gdb libffi-dev libc6-dev; \
9+
docker-php-ext-configure ffi; \
10+
docker-php-ext-install -j$(nproc) ffi pcntl; \
11+
git clone --branch "${LIBRDKAFKA_VERSION}" --depth 1 https://github.com/confluentinc/librdkafka.git /tmp/librdkafka; \
12+
cd /tmp/librdkafka; \
13+
./configure; \
14+
make; \
15+
make install; \
16+
ldconfig; \
17+
apt-get autoremove -y; \
18+
rm -rf /var/lib/apt/lists/*; \
19+
rm -rf /tmp/*;
20+
21+
# install xdebug
22+
ARG XDEBUG_VERSION=beta
23+
RUN pecl install xdebug-${XDEBUG_VERSION}; \
24+
docker-php-ext-enable xdebug;
25+
26+
# install rdkafka ext - this is just required to run the compatibility tests
27+
ARG RDKAFKA_EXT_VERSION=6.x
28+
RUN git clone --branch "$RDKAFKA_EXT_VERSION" --depth 1 https://github.com/arnaud-lb/php-rdkafka.git /tmp/php-rdkafka; \
29+
cd /tmp/php-rdkafka; \
30+
phpize; \
31+
./configure; \
32+
make; \
33+
make install; \
34+
rm -rf /tmp/*;
35+
36+
ENV COMPOSER_HOME /tmp
37+
ENV COMPOSER_ALLOW_SUPERUSER 1
38+
COPY --from=composer /usr/bin/composer /usr/bin/composer
39+
40+
RUN useradd -Ms /bin/bash --user-group --uid 2000 phpdev; \
41+
mkdir /app; \
42+
chown phpdev -R /app; \
43+
chown phpdev -R /tmp;
44+
45+
USER phpdev
46+
47+
WORKDIR /app

resources/ffigen/LibrdkafkaHeaderFiles.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private function loadSupportedVersions(): array
9595
foreach ($releases as $release) {
9696
if ($release->prerelease === false) {
9797
$version = str_replace('v', '', $release->tag_name);
98-
if (Comparator::greaterThanOrEqualTo($version, '1.0.0') && Comparator::lessThan($version, '2.1.0')) {
98+
if (Comparator::greaterThanOrEqualTo($version, '1.0.0') && Comparator::lessThan($version, '2.4.0')) {
9999
$supportedVersions[$version] = sprintf(
100100
self::DOWNLOAD_BASE_URL_TEMPLATE,
101101
$release->tag_name

src/RdKafka/FFI/Library.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ class Library
2828
use Methods;
2929

3030
public const VERSION_AUTODETECT = '';
31-
public const VERSION_LATEST = '2.0.2';
32-
public const PHP_LIBRARY_VERSION = '0.5.0';
31+
public const VERSION_LATEST = '2.3.0';
32+
public const PHP_LIBRARY_VERSION = '0.6.0';
3333

3434
private static FFI $ffi;
3535
private static string $scope = 'RdKafka';

0 commit comments

Comments
 (0)