Skip to content

Commit fc5de1a

Browse files
authored
rename ext (#23)
* rename ext * fix typo * rename ext * change namespace (#26)
1 parent d2e4c7d commit fc5de1a

Some content is hidden

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

54 files changed

+229
-229
lines changed

.github/ISSUE_TEMPLATE

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Please always include the following in an issue:
1313
Add debug logs, by adjusting your configuration:
1414
```php
1515
<?php
16-
$conf = new Kafka\Configuration();
16+
$conf = new SimpleKafkaClient\Configuration();
1717
// Add the two settings below for a more verbose output
1818
$conf->set('log_level', (string) LOG_DEBUG);
1919
$conf->set('debug', 'all');

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
run: './php-kafka/.github/workflows/test/build-php.sh'
6969

7070
- name: 'Build php-kafka'
71-
run: './php-kafka/.github/workflows/test/build-php-kafka.sh'
71+
run: './php-kafka/.github/workflows/test/build-php-simple-kafka-client.sh'
7272

7373
- name: 'Start Kafka'
7474
run: './php-kafka/.github/workflows/test/start-kafka.sh'

.github/workflows/test/build-php-kafka.sh

-17
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
echo "Building php-simple-kafka-client with PHP version:"
6+
php --version
7+
8+
if [ $MEMORY_CHECK -eq 1 ]; then
9+
PHP_SIMPLE_KAFKA_CLIENT_CFLAGS="-Wall -Werror -Wno-deprecated-declarations"
10+
fi
11+
12+
cd php-kafka
13+
phpize
14+
CFLAGS="$PHP_SIMPLE_KAFKA_CLIENT_CFLAGS" ./configure
15+
make
16+
17+
echo "extension=$(pwd)/modules/simple_kafka_client.so"|sudo tee /usr/local/etc/php/simple_kafka_client.ini >/dev/null

config.m4

+10-10
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
dnl $Id$
2-
dnl config.m4 for extension kafka
2+
dnl config.m4 for extension simple_kafka_client
33

4-
PHP_ARG_WITH(kafka, for kafka support,
5-
[ --with-kafka Include kafka support])
4+
PHP_ARG_WITH(simple_kafka_client, for kafka client support,
5+
[ --with-simple-kafka-client Include kafka client support])
66

77
dnl Check whether the extension is enabled at all
8-
if test "$PHP_KAFKA" != "no"; then
8+
if test "$PHP_SIMPLE_KAFKA_CLIENT" != "no"; then
99

1010
SEARCH_PATH="/usr/local /usr" # you might want to change this
1111
SEARCH_FOR="/include/librdkafka/rdkafka.h" # you most likely want to change this
12-
if test -r $PHP_KAFKA/$SEARCH_FOR; then # path given as parameter
13-
RDKAFKA_DIR=$PHP_KAFKA
12+
if test -r $PHP_SIMPLE_KAFKA_CLIENT/$SEARCH_FOR; then # path given as parameter
13+
RDKAFKA_DIR=$PHP_SIMPLE_KAFKA_CLIENT
1414
else # search default path list
1515
AC_MSG_CHECKING([for librdkafka/rdkafka.h" in default path])
1616
for i in $SEARCH_PATH ; do
@@ -28,14 +28,14 @@ if test "$PHP_KAFKA" != "no"; then
2828

2929
PHP_ADD_INCLUDE($RDKAFKA_DIR/include)
3030

31-
SOURCES="kafka.c producer.c metadata.c metadata_broker.c metadata_topic.c metadata_partition.c metadata_collection.c configuration.c topic.c message.c functions.c consumer.c topic_partition.c kafka_exception.c"
31+
SOURCES="simple_kafka_client.c producer.c metadata.c metadata_broker.c metadata_topic.c metadata_partition.c metadata_collection.c configuration.c topic.c message.c functions.c consumer.c topic_partition.c kafka_exception.c"
3232

3333
LIBNAME=rdkafka
3434
LIBSYMBOL=rd_kafka_new
3535

3636
PHP_CHECK_LIBRARY($LIBNAME,$LIBSYMBOL,
3737
[
38-
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $RDKAFKA_DIR/$PHP_LIBDIR, KAFKA_SHARED_LIBADD)
38+
PHP_ADD_LIBRARY_WITH_PATH($LIBNAME, $RDKAFKA_DIR/$PHP_LIBDIR, SIMPLE_KAFKA_CLIENT_SHARED_LIBADD)
3939
AC_DEFINE(HAVE_RDKAFKALIB,1,[ ])
4040
],[
4141
AC_MSG_ERROR([wrong rdkafka lib version or lib not found])
@@ -63,7 +63,7 @@ if test "$PHP_KAFKA" != "no"; then
6363
LDFLAGS="$ORIG_LDFLAGS"
6464
CPPFLAGS="$ORIG_CPPFLAGS"
6565

66-
PHP_SUBST(KAFKA_SHARED_LIBADD)
66+
PHP_SUBST(SIMPLE_KAFKA_CLIENT_SHARED_LIBADD)
6767

68-
PHP_NEW_EXTENSION(kafka, $SOURCES, $ext_shared)
68+
PHP_NEW_EXTENSION(simple_kafka_client, $SOURCES, $ext_shared)
6969
fi

config.w32

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ if (PHP_KAFKA != "no") {
77
if (CHECK_LIB("librdkafka.lib", "rdkafka", PHP_KAFKA) &&
88
CHECK_HEADER_ADD_INCLUDE("librdkafka/rdkafka.h", "CFLAGS_RDKAFKA")) {
99

10-
EXTENSION("rdkafka", "kafka.c producer.c metadata.c metadata_broker.c metadata_topic.c \
10+
EXTENSION("rdkafka", "simple_kafka_client.c producer.c metadata.c metadata_broker.c metadata_topic.c \
1111
metadata_partition.c metadata_collection.c configuration.c \
1212
topic.c message.c functions.c consumer.c topic_partition.c kafka_exception.c");
1313

configuration.c

+11-11
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ kafka_conf_object * get_kafka_conf_object(zval *zconf)
123123
kafka_conf_object *oconf = Z_KAFKA_P(kafka_conf_object, zconf);
124124

125125
if (!oconf->conf) {
126-
zend_throw_exception_ex(NULL, 0, "Kafka\\Configuration::__construct() has not been called");
126+
zend_throw_exception_ex(NULL, 0, "SimpleKafkaClient\\Configuration::__construct() has not been called");
127127
return NULL;
128128
}
129129

@@ -304,7 +304,7 @@ static void kafka_conf_log_cb(const rd_kafka_t *rk, int level, const char *facil
304304
zval_ptr_dtor(&args[3]);
305305
}
306306

307-
/* {{{ proto Kafka\Configuration::__construct() */
307+
/* {{{ proto SimpleKafkaClient\Configuration::__construct() */
308308
ZEND_METHOD(Kafka_Configuration, __construct)
309309
{
310310
kafka_conf_object *intern;
@@ -317,7 +317,7 @@ ZEND_METHOD(Kafka_Configuration, __construct)
317317
}
318318
/* }}} */
319319

320-
/* {{{ proto array Kafka\Configuration::dump()
320+
/* {{{ proto array SimpleKafkaClient\Configuration::dump()
321321
Dump the configuration properties and values of `conf` to an array */
322322
ZEND_METHOD(Kafka_Configuration, dump)
323323
{
@@ -348,7 +348,7 @@ ZEND_METHOD(Kafka_Configuration, dump)
348348
}
349349
/* }}} */
350350

351-
/* {{{ proto void Kafka\Configuration::set(string $name, string $value)
351+
/* {{{ proto void SimpleKafkaClient\Configuration::set(string $name, string $value)
352352
Sets a configuration property. */
353353
ZEND_METHOD(Kafka_Configuration, set)
354354
{
@@ -385,7 +385,7 @@ ZEND_METHOD(Kafka_Configuration, set)
385385
}
386386
/* }}} */
387387

388-
/* {{{ proto void Kafka\Configuration::setErrorCb(callable $callback)
388+
/* {{{ proto void SimpleKafkaClient\Configuration::setErrorCb(callable $callback)
389389
Sets the error callback */
390390
ZEND_METHOD(Kafka_Configuration, setErrorCb)
391391
{
@@ -417,7 +417,7 @@ ZEND_METHOD(Kafka_Configuration, setErrorCb)
417417
}
418418
/* }}} */
419419

420-
/* {{{ proto void Kafka\Configuration::setDrMsgCb(callable $callback)
420+
/* {{{ proto void SimpleKafkaClient\Configuration::setDrMsgCb(callable $callback)
421421
Sets the delivery report callback */
422422
ZEND_METHOD(Kafka_Configuration, setDrMsgCb)
423423
{
@@ -449,7 +449,7 @@ ZEND_METHOD(Kafka_Configuration, setDrMsgCb)
449449
}
450450
/* }}} */
451451

452-
/* {{{ proto void Kafka\Configuration::setStatsCb(callable $callback)
452+
/* {{{ proto void SimpleKafkaClient\Configuration::setStatsCb(callable $callback)
453453
Sets the statistics report callback */
454454
ZEND_METHOD(Kafka_Configuration, setStatsCb)
455455
{
@@ -481,7 +481,7 @@ ZEND_METHOD(Kafka_Configuration, setStatsCb)
481481
}
482482
/* }}} */
483483

484-
/* {{{ proto void Kafka\Configuration::setRebalanceCb(callback $callback)
484+
/* {{{ proto void SimpleKafkaClient\Configuration::setRebalanceCb(callback $callback)
485485
Set rebalance callback for use with coordinated consumer group balancing */
486486
ZEND_METHOD(Kafka_Configuration, setRebalanceCb)
487487
{
@@ -513,7 +513,7 @@ ZEND_METHOD(Kafka_Configuration, setRebalanceCb)
513513
}
514514
/* }}} */
515515

516-
/* {{{ proto void Kafka\Configuration::setOffsetCommitCb(callback $callback)
516+
/* {{{ proto void SimpleKafkaClient\Configuration::setOffsetCommitCb(callback $callback)
517517
Set offset commit callback for use with consumer groups */
518518
ZEND_METHOD(Kafka_Configuration, setOffsetCommitCb)
519519
{
@@ -545,7 +545,7 @@ ZEND_METHOD(Kafka_Configuration, setOffsetCommitCb)
545545
}
546546
/* }}} */
547547

548-
/* {{{ proto void Kafka\Configuration::setLogCb(callback $callback)
548+
/* {{{ proto void SimpleKafkaClient\Configuration::setLogCb(callback $callback)
549549
Set offset commit callback for use with consumer groups */
550550
ZEND_METHOD(Kafka_Configuration, setLogCb)
551551
{
@@ -587,7 +587,7 @@ void kafka_conf_init(INIT_FUNC_ARGS)
587587
handlers.free_obj = kafka_conf_free;
588588
handlers.offset = XtOffsetOf(kafka_conf_object, std);
589589

590-
INIT_NS_CLASS_ENTRY(tmpce, "Kafka", "Configuration", class_Kafka_Configuration_methods);
590+
INIT_NS_CLASS_ENTRY(tmpce, "SimpleKafkaClient", "Configuration", class_Kafka_Configuration_methods);
591591
ce_kafka_conf = zend_register_internal_class(&tmpce);
592592
ce_kafka_conf->create_object = kafka_conf_new;
593593
}

configuration.stub.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
/** @generate-function-entries */
44

5-
namespace Kafka;
5+
namespace SimpleKafkaClient;
66

77
class Configuration
88
{

consumer.c

+21-21
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static object_intern * get_object(zval *zconsumer) /* {{{ */
9393
object_intern *oconsumer = Z_KAFKA_P(object_intern, zconsumer);
9494

9595
if (!oconsumer->rk) {
96-
zend_throw_exception_ex(NULL, 0, "Kafka\\Consumer::__construct() has not been called");
96+
zend_throw_exception_ex(NULL, 0, "SimpleKafkaClient\\Consumer::__construct() has not been called");
9797
return NULL;
9898
}
9999

@@ -119,7 +119,7 @@ static int has_group_id(rd_kafka_conf_t *conf) { /* {{{ */
119119
return 1;
120120
} /* }}} */
121121

122-
/* {{{ proto Kafka\Consumer::__construct(Kafka\Configuration $conf) */
122+
/* {{{ proto SimpleKafkaClient\Consumer::__construct(SimpleKafkaClient\Configuration $conf) */
123123
ZEND_METHOD(Kafka_Consumer, __construct)
124124
{
125125
zval *zconf;
@@ -168,7 +168,7 @@ ZEND_METHOD(Kafka_Consumer, __construct)
168168
}
169169
/* }}} */
170170

171-
/* {{{ proto void Kafka\Consumer::assign([array $topics])
171+
/* {{{ proto void SimpleKafkaClient\Consumer::assign([array $topics])
172172
Atomic assignment of partitions to consume */
173173
ZEND_METHOD(Kafka_Consumer, assign)
174174
{
@@ -213,7 +213,7 @@ ZEND_METHOD(Kafka_Consumer, assign)
213213
}
214214
/* }}} */
215215

216-
/* {{{ proto array Kafka\Consumer::getAssignment()
216+
/* {{{ proto array SimpleKafkaClient\Consumer::getAssignment()
217217
Returns the current partition getAssignment */
218218
ZEND_METHOD(Kafka_Consumer, getAssignment)
219219
{
@@ -241,7 +241,7 @@ ZEND_METHOD(Kafka_Consumer, getAssignment)
241241
}
242242
/* }}} */
243243

244-
/* {{{ proto void Kafka\Consumer::subscribe(array $topics)
244+
/* {{{ proto void SimpleKafkaClient\Consumer::subscribe(array $topics)
245245
Update the subscription set to $topics */
246246
ZEND_METHOD(Kafka_Consumer, subscribe)
247247
{
@@ -281,7 +281,7 @@ ZEND_METHOD(Kafka_Consumer, subscribe)
281281
}
282282
/* }}} */
283283

284-
/* {{{ proto array Kafka\Consumer::getSubscription()
284+
/* {{{ proto array SimpleKafkaClient\Consumer::getSubscription()
285285
Returns the current subscription as set by subscribe() */
286286
ZEND_METHOD(Kafka_Consumer, getSubscription)
287287
{
@@ -315,7 +315,7 @@ ZEND_METHOD(Kafka_Consumer, getSubscription)
315315
}
316316
/* }}} */
317317

318-
/* {{{ proto void Kafka\Consumer::unsubsribe()
318+
/* {{{ proto void SimpleKafkaClient\Consumer::unsubsribe()
319319
Unsubscribe from the current subscription set */
320320
ZEND_METHOD(Kafka_Consumer, unsubscribe)
321321
{
@@ -339,7 +339,7 @@ ZEND_METHOD(Kafka_Consumer, unsubscribe)
339339
}
340340
/* }}} */
341341

342-
/* {{{ proto Message Kafka\Consumer::consume()
342+
/* {{{ proto Message SimpleKafkaClient\Consumer::consume()
343343
Consume message or get error event, triggers callbacks */
344344
ZEND_METHOD(Kafka_Consumer, consume)
345345
{
@@ -434,10 +434,10 @@ static void consumer_commit(int async, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
434434
}
435435
} else if (Z_TYPE_P(zarg) != IS_NULL) {
436436
php_error(E_ERROR,
437-
"Kafka\\Consumer::%s() expects parameter %d to be %s, %s given",
437+
"SimpleKafkaClient\\Consumer::%s() expects parameter %d to be %s, %s given",
438438
get_active_function_name(),
439439
1,
440-
"an instance of Kafka\\Message or an array of Kafka\\TopicPartition",
440+
"an instance of SimpleKafkaClient\\Message or an array of SimpleKafkaClient\\TopicPartition",
441441
zend_zval_type_name(zarg));
442442
return;
443443
}
@@ -456,23 +456,23 @@ static void consumer_commit(int async, INTERNAL_FUNCTION_PARAMETERS) /* {{{ */
456456
}
457457
/* }}} */
458458

459-
/* {{{ proto void Kafka\Consumer::commit([mixed $message_or_offsets])
459+
/* {{{ proto void SimpleKafkaClient\Consumer::commit([mixed $message_or_offsets])
460460
Commit offsets */
461461
ZEND_METHOD(Kafka_Consumer, commit)
462462
{
463463
consumer_commit(0, INTERNAL_FUNCTION_PARAM_PASSTHRU);
464464
}
465465
/* }}} */
466466

467-
/* {{{ proto void Kafka\Consumer::commitAsync([mixed $message_or_offsets])
467+
/* {{{ proto void SimpleKafkaClient\Consumer::commitAsync([mixed $message_or_offsets])
468468
Commit offsets */
469469
ZEND_METHOD(Kafka_Consumer, commitAsync)
470470
{
471471
consumer_commit(1, INTERNAL_FUNCTION_PARAM_PASSTHRU);
472472
}
473473
/* }}} */
474474

475-
/* {{{ proto void Kafka\Consumer::close()
475+
/* {{{ proto void SimpleKafkaClient\Consumer::close()
476476
Close connection */
477477
ZEND_METHOD(Kafka_Consumer, close)
478478
{
@@ -491,7 +491,7 @@ ZEND_METHOD(Kafka_Consumer, close)
491491
}
492492
/* }}} */
493493

494-
/* {{{ proto Metadata Kafka\Consumer::getMetadata(bool all_topics, int timeout_ms, Kafka\Topic only_topic = null)
494+
/* {{{ proto Metadata SimpleKafkaClient\Consumer::getMetadata(bool all_topics, int timeout_ms, SimpleKafkaClient\Topic only_topic = null)
495495
Request Metadata from broker */
496496
ZEND_METHOD(Kafka_Consumer, getMetadata)
497497
{
@@ -533,8 +533,8 @@ ZEND_METHOD(Kafka_Consumer, getMetadata)
533533
}
534534
/* }}} */
535535

536-
/* {{{ proto Kafka\ConsumerTopic Kafka\Consumer::getTopicHandle(string $topic)
537-
Returns a Kafka\ConsumerTopic object */
536+
/* {{{ proto SimpleKafkaClient\ConsumerTopic SimpleKafkaClient\Consumer::getTopicHandle(string $topic)
537+
Returns a SimpleKafkaClient\ConsumerTopic object */
538538
ZEND_METHOD(Kafka_Consumer, getTopicHandle)
539539
{
540540
char *topic;
@@ -571,7 +571,7 @@ ZEND_METHOD(Kafka_Consumer, getTopicHandle)
571571
}
572572
/* }}} */
573573

574-
/* {{{ proto array Kafka\Consumer::getCommittedOffsets(array $topics, int timeout_ms)
574+
/* {{{ proto array SimpleKafkaClient\Consumer::getCommittedOffsets(array $topics, int timeout_ms)
575575
Retrieve committed offsets for topics+partitions */
576576
ZEND_METHOD(Kafka_Consumer, getCommittedOffsets)
577577
{
@@ -610,7 +610,7 @@ ZEND_METHOD(Kafka_Consumer, getCommittedOffsets)
610610

611611
/* }}} */
612612

613-
/* {{{ proto array Kafka\Consumer::getOffsetPositions(array $topics)
613+
/* {{{ proto array SimpleKafkaClient\Consumer::getOffsetPositions(array $topics)
614614
Retrieve current offsets for topics+partitions */
615615
ZEND_METHOD(Kafka_Consumer, getOffsetPositions)
616616
{
@@ -645,7 +645,7 @@ ZEND_METHOD(Kafka_Consumer, getOffsetPositions)
645645
}
646646
/* }}} */
647647

648-
/* {{{ proto void Kafka\Consumer::offsetsForTimes(array $topicPartitions, int $timeout_ms)
648+
/* {{{ proto void SimpleKafkaClient\Consumer::offsetsForTimes(array $topicPartitions, int $timeout_ms)
649649
Look up the offsets for the given partitions by timestamp. */
650650
ZEND_METHOD(Kafka_Consumer, offsetsForTimes)
651651
{
@@ -682,7 +682,7 @@ ZEND_METHOD(Kafka_Consumer, offsetsForTimes)
682682
}
683683
/* }}} */
684684

685-
/* {{{ proto void Kafka\Consumer::queryWatermarkOffsets(string $topic, int $partition, int &$low, int &$high, int $timeout_ms)
685+
/* {{{ proto void SimpleKafkaClient\Consumer::queryWatermarkOffsets(string $topic, int $partition, int &$low, int &$high, int $timeout_ms)
686686
Query broker for low (oldest/beginning) or high (newest/end) offsets for partition */
687687
ZEND_METHOD(Kafka_Consumer, queryWatermarkOffsets)
688688
{
@@ -726,7 +726,7 @@ void kafka_consumer_init(INIT_FUNC_ARGS) /* {{{ */
726726
{
727727
zend_class_entry tmpce;
728728

729-
INIT_NS_CLASS_ENTRY(tmpce, "Kafka", "Consumer", class_Kafka_Consumer_methods);
729+
INIT_NS_CLASS_ENTRY(tmpce, "SimpleKafkaClient", "Consumer", class_Kafka_Consumer_methods);
730730
ce = zend_register_internal_class(&tmpce);
731731
ce->create_object = kafka_consumer_new;
732732

0 commit comments

Comments
 (0)