feat: implement fluent facade API for Paystack support classes and ad… - #52
Open
myckhel wants to merge 4 commits into
Open
feat: implement fluent facade API for Paystack support classes and ad…#52myckhel wants to merge 4 commits into
myckhel wants to merge 4 commits into
Conversation
…d integration tests
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a fluent (facade-based) entrypoint for resolving Paystack support classes from Laravel apps, and adds tests + documentation to demonstrate the new usage pattern.
Changes:
- Expanded
Binkode\Paystack\Paystackwith fluent endpoint methods (singular/plural) plus a dynamic fallback resolver. - Added facade PHPDoc
@methodannotations to improve IDE autocomplete for fluent calls. - Added integration-style tests using Laravel HTTP fakes and updated the README with fluent examples.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
src/Paystack.php |
Adds fluent endpoint methods and __call()-based dynamic resolution for support classes. |
src/Facades/Paystack.php |
Adds PHPDoc @method annotations for IDE autocomplete of fluent endpoints. |
tests/PaystackTest.php |
Adds tests for facade resolution and example HTTP calls via Http::fake(). |
readme.md |
Documents fluent facade usage alongside the existing static support API usage. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+51
to
+54
| $response = Paystack::transactions()->initialize([ | ||
| 'amount' => 10000, | ||
| 'email' => 'user@example.com' | ||
| ]); |
Comment on lines
+73
to
+77
| $response = Paystack::customers()->create([ | ||
| 'email' => 'customer@example.com', | ||
| 'first_name' => 'John', | ||
| 'last_name' => 'Doe' | ||
| ]); |
Comment on lines
+66
to
+75
| Using the `Paystack` facade, you can call any support endpoint dynamically as an instance method (supporting both singular and plural forms): | ||
|
|
||
| ```php | ||
| use Binkode\Paystack\Facades\Paystack; | ||
|
|
||
| // Initialize a transaction | ||
| $init = Paystack::transactions()->initialize([ | ||
| "email" => "customer@example.com", | ||
| "amount" => 500000, // amount in kobo | ||
| ]); |
| return $mappings[$key]; | ||
| } | ||
|
|
||
| $cleaned = str_replace(['_', '-'], '', $method); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…d integration tests