Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
RamiiYoussef committed Feb 20, 2024
0 parents commit ac3503a
Show file tree
Hide file tree
Showing 45 changed files with 11,140 additions and 0 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Tests

on:
push:
pull_request:
schedule:
- cron: '0 4 * * *'

jobs:
test:

runs-on: ubuntu-latest

strategy:
matrix:
php: [7.4, 7.3]
laravel: [7.*]
phpunit: [9.*]
dependency-version: [prefer-lowest, prefer-stable]
include:
- laravel: 7.*
php: 7.4
phpunit: 9.0
dependency-version: prefer-stable
- laravel: 6.*
php: 7.3
phpunit: 9.0
dependency-version: prefer-stable
- laravel: 7.*
php: 7.2
phpunit: 8.*
dependency-version: prefer-stable

name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Install Librdkafka
run: |
wget -qO - https://packages.confluent.io/deb/5.4/archive.key | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://packages.confluent.io/deb/5.4 stable main"
sudo apt-get update
sudo apt-get install librdkafka-dev
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: composer, pecl
extensions: curl, libxml, mbstring, zip, bcmath, rdkafka
coverage: pcov

- name: Install dependencies
run: |
composer remove phpro/grumphp --no-interaction --no-update --dev
composer require "laravel/framework:${{ matrix.laravel }}" "phpunit/phpunit:${{ matrix.phpunit }}" --no-interaction --no-update
composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-suggest
- name: Execute Unit Tests
run: composer test -- --coverage-clover coverage/coverage.xml

- name: Check PSR-12 Codestyle
run: composer lint

- name: Upload Coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage/coverage.xml
fail_ci_if_error: true
49 changes: 49 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig

# Created by https://www.gitignore.io/api/visualstudiocode,macos,laravel
# Edit at https://www.gitignore.io/?templates=visualstudiocode,macos,laravel

### Laravel ###
/vendor/

### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json

### VisualStudioCode Patch ###
# Ignore all local history of files
.history

# End of https://www.gitignore.io/api/visualstudiocode,macos,laravel

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

/coverage/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Andreas Pfurtscheller

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# laravel-kafka: A queue driver for Laravel

laravel-kafka adds support for Apache Kafka to Laravel Queues. It builds upon the [rdkafka](https://github.com/arnaud-lb/php-rdkafka) php extension, which you will have to install seperately. Also, you have to install the C/C++ client library [librdkafka](https://github.com/edenhill/librdkafka) upfront. Afterwards, you can freely push jobs to your favorite Kafka queue!

laravel-kafka supports PHP 8.1/8.2 and Laravel 9/10.

## Installation

To install the latest version of `ramiiyoussef/laravel-kafka` just require it using composer.

```bash
composer require ramiiyoussef/laravel-kafka
```

This package is using Laravel's package auto-discovery, so it doesn't require you to manually add the ServiceProvider. If you've opted out of this feature, add the ServiceProvider to the providers array in config/app.php:

```php
RamiiYoussef\Kafka\ServiceProvider::class,
```

```bash
php artisan vendor:publish --provider="RamiiYoussef\Kafka\ServiceProvider"
```

## Licence

Kafkaesk is licenced under The MIT Licence (MIT).
51 changes: 51 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"name": "ramiiyoussef/laravel-kafka",
"description": "Laravel Kafka Queue Driver",
"type": "library",
"license": "MIT",
"authors": [
{
"name": "Rami Youssef",
"email": "[email protected]"
}
],
"scripts": {
"test": "APP_ENV=test vendor/bin/phpunit",
"lint": "./vendor/bin/phpcs -p --standard=psr12 src/ config/ tests/",
"lint:fix": "./vendor/bin/phpcbf -p --standard=psr12 src/ config/ tests/"
},
"require": {
"php": ">=8.1",
"ext-rdkafka": "*",
"graham-campbell/manager": "^5.1"
},
"require-dev": {
"graham-campbell/analyzer": "^4.1",
"graham-campbell/testbench": "^6.1",
"hamcrest/hamcrest-php": "^2.0",
"kwn/php-rdkafka-stubs": "^2.2",
"mockery/mockery": "^1.6",
"phpro/grumphp": "^2.5",
"phpunit/phpunit": "^11.0",
"squizlabs/php_codesniffer": "^3.9"
},
"autoload": {
"psr-4": {
"RamiiYoussef\\Kafka\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"RamiiYoussef\\Kafka\\Tests\\": "tests/"
}
},
"extra": {
"laravel": {
"providers": [
"RamiiYoussef\\Kafka\\ServiceProvider"
]
}
},
"minimum-stability": "dev",
"prefer-stable": true
}
Loading

0 comments on commit ac3503a

Please sign in to comment.