Skip to content

Commit 03bb4af

Browse files
init
0 parents  commit 03bb4af

File tree

11 files changed

+5681
-0
lines changed

11 files changed

+5681
-0
lines changed

.editorconfig

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
indent_style = space
8+
indent_size = 4
9+
trim_trailing_whitespace = true
10+
11+
[*.md]
12+
trim_trailing_whitespace = false
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.env.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
KAFKA_BOOTSTRAP_SERVERS=<kafka-bootstrap-servers>
2+
KAFKA_TOPIC_NAME=<kafka-topic-name>
3+
KAFKA_GROUP_ID=<kafka-group-id>

.github/workflows/ci.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Set up PHP
19+
uses: shivammathur/setup-php@15c43e89cdef867065b0213be354c2841860869e
20+
with:
21+
php-version: "8.2"
22+
23+
- name: Install PHP dependencies
24+
run: |
25+
sudo apt-get update
26+
sudo apt-get install -y librdkafka-dev
27+
sudo pecl install rdkafka
28+
echo "extension=rdkafka.so" | sudo tee -a /etc/php/8.3/cli/php.ini
29+
30+
- name: Checkout code
31+
uses: actions/checkout@v3
32+
33+
- name: Validate composer.json and composer.lock
34+
run: composer validate --strict
35+
36+
- name: Install dependencies
37+
run: composer install --prefer-dist --no-interaction --no-progress
38+
39+
- name: Validate PHP PSR
40+
run: composer run-script php-fixer

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/vendor
2+
.env

README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# kafka-queue
2+
3+
- https://arnaud-lb.github.io/php-rdkafka-doc/phpdoc/rdkafka.installation.html
4+
5+
installing
6+
```sh
7+
composer require multividas/kafka-queue:dev-main --dev
8+
```
9+
10+
### ServiceProvider (KafkaServiceProvider):
11+
12+
- Registers the Kafka queue connector with Laravel's queue manager.
13+
14+
### Implements the QueueContract interface.
15+
16+
- Provides methods like push, pop, and size for interacting with Kafka.
17+
- push() pushes a serialized job to Kafka using the producer.
18+
- pop() consumes messages from Kafka and processes jobs.
19+
20+
### Connector Class (KafkaConnector):
21+
22+
- Implements the ConnectorInterface.
23+
- Sets up Kafka producer and consumer.

composer.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "multividas/kafka-queue",
3+
"license": "MIT",
4+
"description": "Kafka Queue for PHP",
5+
"authors": [
6+
{
7+
"name": "Soulaimane Yahya",
8+
"email": "[email protected]"
9+
}
10+
],
11+
"autoload": {
12+
"psr-4": {
13+
"Kafka\\": "src/"
14+
}
15+
},
16+
"require": {
17+
"php": "^8.2",
18+
"laravel/lumen-framework": "^10.0",
19+
"squizlabs/php_codesniffer": "^3.7",
20+
"jobcloud/php-kafka-lib": "^2.0"
21+
},
22+
"scripts": {
23+
"php-fixer": [
24+
"./vendor/bin/phpcs src --standard=PSR2"
25+
]
26+
},
27+
"extra": {
28+
"laravel": {
29+
"providers": [
30+
"Kafka\\Providers\\KafkaServiceProvider"
31+
]
32+
}
33+
},
34+
"minimum-stability": "dev"
35+
}

0 commit comments

Comments
 (0)