Download the PHP package coderatio/paystack-mirror without Composer

On this page you can find all versions of the php package coderatio/paystack-mirror. 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 paystack-mirror

The missing Paystack PHP Library.


Overview

Paystack Mirror is a clean, simple and fluent php library for paystack payment gateway. This library is birthed out of the fact that I needed something flexible than what is in existance for myself and the php community.

What was wrong with the existing one?

The official paystack library for php is the yabacon/paystack-php on github. It's cool. Supports almost all paystack end-points and some other cool features like a dedicated Fee class, MetaDataBuilder class and Event handler class. Many people have been using the library but I wanted something that can give people freedom over what they do. I wanted something that supports multiple accounts at once. It's why I decided to work on this library.

What is unique about the library?

  1. The conversion of paystack end-points to full fledged extendable php classes.
  2. Supports for multiple accounts
  3. Clean and better event handler class
  4. Fluent Params Builder class
  5. Nigerian money conversion e.g 1k => 1,000 naira and 1,000 naira => 100000 kobo and even (millions(xM), billions(xB), trillions(xT)) to kobo e.t.c.

Server Requirements

PHP version ^7.1.3 requirement was done intentionally. Reason been that it's safer, better and faster than 5.6 and 7.0. So, if you have been using php version less than that, kindly upgrade before using this library.

  • php ^7.1.3
  • cURL extension enabled
  • OpenSSL extension enabled

This library has suppports for all Paystack end-points which we refer to as Actions. Let's take a look at the available actions.

List of actions groups

Below are actions groups supported by the library in alphabetical order.

  1. BULK CHARGES
  2. CHARGES
  3. CONTROL PANEL
  4. CUSTOMERS
  5. INVOICES
  6. MISCELLANEOUS
  7. PAGES
  8. PLANS
  9. REFUNDS
  10. SETTLEMENTS
  11. SUB-ACCOUNTS
  12. SUBSCRIPTIONS
  13. TRANSACTIONS
  14. TRANSFER RECIPIENTS
  15. TRANSFERS
  16. TRANSFERS CONTROL
  17. VERIFICATIONS

Note: To see the list of all actions under each action groups available on this library, kindly Click Here.

Arrangements are on the way to list all of them like the first two above.

Installation

Usage

With Single Paystack Account

Method One

Method Two

Method Three

Method Four

Notice: By default, ->getResponse() returns a json object. But, you can chain ->asArray() to convert the response to php array or ->asObject() to conver the response to php object at runtime.

With Multiple Paystack Accounts

With this library, you can mirror single action on multiple paystack accounts. This is super cool for multitenants applications or firms with multiple paystack accounts.

Let's see how to do it.

You can overwrite all the accounts data by providing your params on the action. When that is done, the library will use the parameters supplied on the action for all the accounts instead e.g

Quick Note: All the query or body params used on paystack api documentation site are all available in this library. The only different is, they must be sent as an array or as ParamBuilder::class object.

Create your action

One good thing about this library is the ability to plug and play actions. You can replace existing actions by creating yours.

Please note that $this->data property returns an array. If you want to send parameters as json to paystack, use $this->getData().

Webhook Event Handling

This library ships with a fluent Event handling class to be used at your webhook url set on your paystack dashboard. See example below on how to listen to different events.

Create a separate event class

With this library, you can write a separate event class for a single event. For example, the subscription.create event can be created like this:

This can then be used like this:

Here, you can see that we are just implementing the ActionEvent::class interface and extending the Event::class on the ::validate() method.

Addons

The library has a few of in-built functionalities to do somethings quicker and better. Let's take a look at them:

1. Nairas to kobo

Since paystack accepts amount in kobo only, there should be a quick way to do that. Below are helper functions to help you out.

Note: The short_naira_to_kobo() helper function, supports only k as thousands, m as millions, b as billions and t as trillions notations.

2. Reference Generator

You can easily generate especially, transaction reference easily by doing this:

Todo

  1. Build a dedicated docs site

Tests

Contributions

Correcting a typographical error is a huge a contribution to this project. Do well to do that. You can fork the repo and send pull request or reach out easily to me via twitter here => Josiah Ovye Yahaya.

Collaborators

  1. Josiah O. Yahaya
  2. Ndubuisi Onyemenam

Licence

This project is built and used with GPL.3.0 licence.


All versions of paystack-mirror with dependencies

PHP Build Version
Package Version
Requires php Version >=7.1
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 coderatio/paystack-mirror contains the following files

Loading the files please wait ....