Skip to content

Commit 263ca4d

Browse files
committed
Initial commit
0 parents  commit 263ca4d

45 files changed

Lines changed: 12968 additions & 0 deletions

Some content is hidden

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

.env.example

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
FLUTTERWAVE_SECRET_KEY=FLWSECK_TEST-06cacc67bc5cb0ac0caa3635bf6d934d-X

.github/workflows/php.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: ["main", "develop"]
6+
pull_request:
7+
branches: ["main", "develop"]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
tests:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
php: [8.2, 8.3]
21+
22+
steps:
23+
- name: Checkout code
24+
uses: actions/checkout@v4
25+
26+
- name: Setup PHP
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php }}
30+
extensions: mbstring, dom, fileinfo
31+
tools: composer
32+
coverage: none
33+
34+
- name: Validate composer.json and composer.lock
35+
run: composer validate --strict
36+
37+
- name: Cache Composer dependencies
38+
uses: actions/cache@v3
39+
with:
40+
path: vendor
41+
key: ${{ runner.os }}-php-${{ matrix.php }}-${{ hashFiles('**/composer.lock') }}
42+
restore-keys: |
43+
${{ runner.os }}-php-${{ matrix.php }}-
44+
45+
- name: Install dependencies
46+
run: composer install --prefer-dist --no-progress --no-interaction
47+
48+
- name: Run tests
49+
run: vendor/bin/phpunit
50+
51+
- name: Run static analysis
52+
run: composer lint
53+
54+
- name: Run style check
55+
run: vendor/bin/php-cs-fixer fix --dry-run --diff

.gitignore

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Composer
2+
composer.phar
3+
/vendor/
4+
5+
# Environment
6+
.env
7+
.env.*
8+
!.env.example
9+
10+
# IDE & Editors
11+
.idea/
12+
.vscode/
13+
*.swp
14+
*.swo
15+
*~
16+
.DS_Store
17+
Thumbs.db
18+
19+
# PHP
20+
*.log
21+
22+
# Testing & Coverage
23+
.phpunit.result.cache
24+
.phpunit.cache/
25+
coverage/
26+
coverage.xml
27+
clover.xml
28+
29+
# Build artifacts
30+
/build/
31+
/dist/

.php-cs-fixer.cache

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"php":"8.1.34","version":"3.94.2:v3.94.2#7787ceff91365ba7d623ec410b8f429cdebb4f63","indent":" ","lineEnding":"\n","rules":{"binary_operator_spaces":true,"blank_line_after_opening_tag":true,"blank_line_between_import_groups":true,"blank_lines_before_namespace":true,"braces_position":{"allow_single_line_anonymous_functions":false,"allow_single_line_empty_anonymous_classes":true},"class_definition":{"inline_constructor_arguments":false,"space_before_parenthesis":true},"compact_nullable_type_declaration":true,"declare_equal_normalize":true,"lowercase_cast":true,"lowercase_static_reference":true,"modifier_keywords":true,"new_with_parentheses":{"anonymous_class":true},"no_blank_lines_after_class_opening":true,"no_extra_blank_lines":{"tokens":["use"]},"no_leading_import_slash":true,"no_whitespace_in_blank_line":true,"ordered_class_elements":{"order":["use_trait"]},"ordered_imports":{"sort_algorithm":"alpha"},"return_type_declaration":true,"short_scalar_cast":true,"single_import_per_statement":{"group_to_single_imports":false},"single_space_around_construct":{"constructs_followed_by_a_single_space":["abstract","as","case","catch","class","const_import","do","else","elseif","final","finally","for","foreach","function","function_import","if","insteadof","interface","namespace","new","private","protected","public","static","switch","trait","try","use","use_lambda","while"],"constructs_preceded_by_a_single_space":["as","else","elseif","use_lambda"]},"single_trait_insert_per_statement":true,"ternary_operator_spaces":true,"unary_operator_spaces":true,"blank_line_after_namespace":true,"constant_case":true,"control_structure_braces":true,"control_structure_continuation_position":true,"elseif":true,"function_declaration":{"closure_fn_spacing":"one"},"indentation_type":true,"line_ending":true,"lowercase_keywords":true,"method_argument_space":{"on_multiline":"ensure_fully_multiline","keep_multiple_spaces_after_comma":true},"no_break_comment":true,"no_closing_tag":true,"no_multiple_statements_per_line":true,"no_space_around_double_colon":true,"no_spaces_after_function_name":true,"no_trailing_whitespace":true,"no_trailing_whitespace_in_comment":true,"single_blank_line_at_eof":true,"single_class_element_per_statement":{"elements":["property"]},"single_line_after_imports":true,"spaces_inside_parentheses":true,"statement_indentation":true,"switch_case_semicolon_to_colon":true,"switch_case_space":true,"encoding":true,"full_opening_tag":true,"array_syntax":{"syntax":"short"},"no_unused_imports":true,"not_operator_with_successor_space":true,"trailing_comma_in_multiline":true,"phpdoc_scalar":true,"blank_line_before_statement":{"statements":["break","continue","declare","return","throw","try"]},"phpdoc_single_line_var_spacing":true,"phpdoc_var_without_name":true},"ruleCustomisationPolicyVersion":"null-policy","hashes":{"examples\/transfers\/list.php":"519fc34386d254d38dc52ff7108e2ba5","examples\/transfers\/initiate.php":"c565a08243f225c0b42cadf00073efe9","examples\/config.php":"6f5448fe07a11b4829c8d95b790d0db1","examples\/transactions\/list.php":"586820159b616ab6aa5d41f8a73ad35e","examples\/transactions\/initialize.php":"6e4e00f3c2aafa1314629f88dfa6dbb0","examples\/transactions\/verify.php":"bcacd0957103755b8e7cfb28286d77ff","examples\/refunds\/initiate.php":"3d4275c3b251acea55cb4cbd50a6cf3c","src\/Contracts\/HttpClientInterface.php":"60a36521b3037c0507dcbba3f39ce759","src\/Resources\/Transactions.php":"701984777365393761f40c7ae4ed8757","src\/Resources\/Transfers.php":"8abf8267afac81d4425bc8c707841d45","src\/Resources\/Refunds.php":"9e72c549aff4702ae1fda9c6a614fe57","src\/Resources\/AbstractResource.php":"8a73610d65fa0c675ebbf2569993442a","src\/Payloads\/PayloadInterface.php":"b4b7011b9c7dedea4e199e2c5e36e7de","src\/Payloads\/RefundPayload.php":"98893753ee5d62d5fee5a038d3c779e1","src\/Payloads\/CustomerPayload.php":"792d33ca3c0aa10bd1b8c2fe0432437b","src\/Payloads\/CustomizationsPayload.php":"46d791b4f1d9802cf268b9ea4d491036","src\/Payloads\/AbstractPayload.php":"d9c35457141fa1e7aa7de9df44a815d8","src\/Payloads\/TransferPayload.php":"3c5f02ba35478d6ac45f9a8ffd07e355","src\/Payloads\/PaymentPayload.php":"0cc2e169d543948833ce686a967ba3bb","src\/Exceptions\/FlutterwaveException.php":"f35f25d27354d9beadb34f3070d39d99","src\/Flutterwave.php":"49e707de4eccb398841cab1b7a1fbcc5","src\/Http\/GuzzleHttpClient.php":"5aaf2fef620029b0f2031c5636f8f63e","tests\/TransactionsTest.php":"cda69d9df365b6fa4feb1cb657c34fa0","tests\/FlutterwaveExceptionTest.php":"d63c9caf7ab675ee08a230847f8ec8d6","tests\/PayloadsTest.php":"0a09afa2f0818b96672d9a128b77c113","tests\/RefundsTest.php":"3d67748aa3244a88aa5fc449a9c9e553","examples\/index.php":"23872a1b80f2a4b9e64965b428ec1b57"}}

.php-cs-fixer.dist.php

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<?php
2+
3+
$finder = PhpCsFixer\Finder::create()
4+
->in([
5+
__DIR__ . '/src',
6+
__DIR__ . '/tests',
7+
__DIR__ . '/examples',
8+
])
9+
->name('*.php')
10+
->ignoreDotFiles(true)
11+
->ignoreVCS(true);
12+
13+
$config = new PhpCsFixer\Config();
14+
15+
return $config->setRules([
16+
'@PSR12' => true,
17+
'array_syntax' => ['syntax' => 'short'],
18+
'ordered_imports' => ['sort_algorithm' => 'alpha'],
19+
'no_unused_imports' => true,
20+
'not_operator_with_successor_space' => true,
21+
'trailing_comma_in_multiline' => true,
22+
'phpdoc_scalar' => true,
23+
'unary_operator_spaces' => true,
24+
'binary_operator_spaces' => true,
25+
'blank_line_before_statement' => [
26+
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'try'],
27+
],
28+
'phpdoc_single_line_var_spacing' => true,
29+
'phpdoc_var_without_name' => true,
30+
'method_argument_space' => [
31+
'on_multiline' => 'ensure_fully_multiline',
32+
'keep_multiple_spaces_after_comma' => true,
33+
],
34+
])
35+
->setFinder($finder);

CODE_OF_CONDUCT.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to creating a positive environment include:
10+
11+
* Using welcoming and inclusive language
12+
* Being respectful of differing viewpoints and experiences
13+
* Gracefully accepting constructive criticism
14+
* Focusing on what is best for the community
15+
* Showing empathy towards other community members
16+
17+
Examples of unacceptable behavior by participants include:
18+
19+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
20+
* Trolling, insulting/derogatory comments, and personal or political attacks
21+
* Public or private harassment
22+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
23+
* Other conduct which could reasonably be considered inappropriate in a professional setting
24+
25+
## Our Responsibilities
26+
27+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
28+
29+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
30+
31+
## Scope
32+
33+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
34+
35+
## Enforcement
36+
37+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at info@kommandhub.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
38+
39+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
40+
41+
## Attribution
42+
43+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
44+
45+
[homepage]: http://contributor-covenant.org
46+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Contributing
2+
3+
Contributions are **welcome** and will be fully **credited**.
4+
5+
6+
## Pull Requests
7+
8+
- **[PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md)**.
9+
10+
- **Document any change in behaviour** - Make sure the `README.md` and any other relevant documentation are kept up-to-date.
11+
12+
- **Create feature branches** - Don't ask us to pull from your master branch.
13+
14+
- **One pull request per feature** - If you want to do more than one thing, send multiple pull requests.
15+
16+
- **Pull requests go against develop branch** - So we can test it before merging it onto master.
17+
18+
- **Send coherent history** - Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please [squash them](http://www.git-scm.com/book/en/v2/Git-Tools-Rewriting-History#Changing-Multiple-Commit-Messages) before submitting.

Dockerfile

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
FROM php:8.1-cli-alpine
2+
3+
# Install system dependencies
4+
RUN apk add --no-cache \
5+
git \
6+
unzip \
7+
libzip-dev \
8+
autoconf \
9+
g++ \
10+
make \
11+
linux-headers
12+
13+
# Install PHP extensions
14+
RUN docker-php-ext-install zip pcntl
15+
16+
# Install Xdebug
17+
RUN pecl install xdebug \
18+
&& docker-php-ext-enable xdebug
19+
20+
# Install Composer
21+
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
22+
23+
# Configure Xdebug
24+
RUN echo "xdebug.mode=debug,develop" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
25+
&& echo "xdebug.client_host=host.docker.internal" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
26+
&& echo "xdebug.start_with_request=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
27+
&& echo "xdebug.discover_client_host=yes" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini \
28+
&& echo "xdebug.idekey=PHPSTORM" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
29+
30+
# Set working directory
31+
WORKDIR /app
32+
33+
# Ensure vendor directory exists and dependencies are installed
34+
# We do this in a separate script or just before starting the server
35+
# to ensure the volume mapping doesn't override it if not needed.
36+
37+
# Expose port for PHP built-in server (examples)
38+
EXPOSE 8000
39+
40+
CMD ["sh", "-c", "composer install && php -S 0.0.0.0:8000 -t examples"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 KommandHub
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

Makefile

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
.PHONY: help install test lint format up down build logs shell
2+
3+
help: ## Show this help
4+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
5+
6+
install: ## Install composer dependencies locally
7+
composer install
8+
9+
test: ## Run PHPUnit tests
10+
composer test
11+
12+
lint: ## Run static analysis (PHPStan)
13+
composer lint
14+
15+
format: ## Automatically fix code style issues
16+
composer format
17+
18+
up: ## Start the Docker environment
19+
docker-compose up -d
20+
21+
down: ## Stop the Docker environment
22+
docker-compose down
23+
24+
build: ## Build/rebuild the Docker image
25+
docker-compose up -d --build
26+
27+
logs: ## Follow Docker logs
28+
docker-compose logs -f app
29+
30+
shell: ## Access the app container shell
31+
docker-compose exec app sh

0 commit comments

Comments
 (0)