Download the PHP package emmo00/mock-paystack-laravel without Composer

On this page you can find all versions of the php package emmo00/mock-paystack-laravel. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mock-paystack-laravel

mock-paystack-laravel

PHP package for mocking Paystack responses and webhooks.

Overview

MockPaystack is a Laravel package designed to simplify testing and development involving Paystack integrations. The MockPaystack package is a tool designed for developers to test and simulate interactions with Paystack APIs in a controlled environment. It provides utility classes, traits, and constants to handle various Paystack API operations, including webhooks, payment initialization, and response simulation.

This package includes utilities for handling HTTP requests and responses, and it offers support for both Illuminate\Http\Client (Laravel HTTP client) and GuzzleHttp clients, ensuring compatibility with a wide range of use cases.


Installation

Prerequisites

Installation Steps

  1. Add the package to your Laravel project using Composer:

  2. Use trait in test class

Features


Example

Here's a basic example of using the MockPaystack package:

Usage

Trait: MockPaystack

This trait provides utility methods for handling HTTP requests, responses and webhook.

Initialize Payment Handler

methods to simulate and validate Paystack payment initialization requests.

Methods

fakeInitializePayment()

Description: Simulates an initialize payment request, ensuring required properties like email, amount, currency, and Authorization header are present.

Usage:


fakeInitializePaymentSuccess()

Description: Simulates a successful initialize payment request.

Usage:


fakeInitializePaymentFailure()

Description: Simulates a failed initialize payment request.

Usage:


fakeInitializePaymentInvalidKey()

Description: Simulates a request with an invalid Authorization key.

Usage:


fakeInitializePaymentInvalidRequest()

Description: Simulates a request with invalid payload or headers.

Usage:


fakeInitializePaymentInvalidCurrency()

Description: Simulates a request with an unsupported or missing currency field.

Usage:


fakeInitializePaymentInvalidAmount()

Description: Simulates a request with an invalid or missing amount field.

Usage:


fakeInitializePaymentInvalidEmail()

Description: Simulates a request with an invalid or missing email field.

Usage:


Charge Success Webhook Handler

MockPaystack also provides methods to simulate Paystack webhook notifications, like for the charge.success event.

fakeWebHookChargeSuccess()

Description: Sends a fake webhook charge.success notification to your Paystack webhook handler route.

Parameters:

Returns: \Illuminate\Testing\TestResponse: The response from your webhook handler route.

Usage:



Contributing

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix:

  3. Commit your changes:

  4. Push to the branch:

  5. Open a pull request.

License

This package is open-source software licensed under the MIT license.


Contact

For questions or support, please reach out to Emmanuel Nwafor.


All versions of mock-paystack-laravel with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
guzzlehttp/guzzle Version ^7.0
guzzlehttp/psr7 Version ^2.0
illuminate/http Version ^11.36
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package emmo00/mock-paystack-laravel contains the following files

Loading the files please wait ....