PHPackages                             ayoolatj/paystack-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Payment Processing](/categories/payments)
4. /
5. ayoolatj/paystack-php

ActiveLibrary[Payment Processing](/categories/payments)

ayoolatj/paystack-php
=====================

Yet Another Paystack PHP Library

1.2.1(5y ago)211MITPHPPHP &gt;=7.1.0CI failing

Since Jul 12Pushed 5y ago1 watchersCompare

[ Source](https://github.com/ayoolatj/paystack-php)[ Packagist](https://packagist.org/packages/ayoolatj/paystack-php)[ RSS](/packages/ayoolatj-paystack-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (3)Dependencies (4)Versions (7)Used By (0)

Yet another PHP API wrapper for [Paystack](https://paystack.co/).
=================================================================

[](#yet-another-php-api-wrapper-for-paystack)

[![Packagist](https://camo.githubusercontent.com/60fabcb766660aadeabeb86b6b6a73d9b109559dd6a5857b7060041335630da9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f61796f6f6c61746a2f706179737461636b2d7068702e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/ayoolatj/paystack-php)[![License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)

This library aims to provide convenient access to the Paystack API using predefined services grouped following the [Paystack API Docs](https://paystack.com/docs/api/). These service classes initialize defined Resources dynamically from API responses.

Requirements
------------

[](#requirements)

- PHP 7.1+

Installing
----------

[](#installing)

### via Composer

[](#via-composer)

To install the package via [Composer](http://getcomposer.org/), run the following command:

```
composer require ayoolatj/paystack-php
```

Dependencies
------------

[](#dependencies)

- [Guzzle](https://github.com/guzzle/guzzle)

Dependencies should be handled automatically by composer.

Usage
-----

[](#usage)

Using the paystack instance, you can perform multiple actions across several services as well as retrieve different resources.

```
$paystack = new \Ayoolatj\Paystack\Paystack(PAYSTACK_SECRET_KEY);
try {
    $charge = $paystack->charge->charge([
        'email' => 'test@example.com',
        'amount' => '1000000',
        'bank' => ['code' => '057', 'account_number' => '0000000000'],
        'birthday' => '1994-07-04',
    ]);
} catch (\Ayoolatj\Paystack\Exceptions\ApiException $e) {
    print_r($e->getResponse());
}
// process Charge resource
```

### Accessing Resource Attributes

[](#accessing-resource-attributes)

You can access the resource attributes via `toArray()`.

```
$plan = $paystack->plans->create([
    'name' => 'New Plan',
    'amount' => '1000000',
    'interval' => 'biannually'
]);
print_r($plan->toArray());
```

### Accessing response data

[](#accessing-response-data)

You can access the data from the last API response on any resource object via `getLastResponse()`.

```
$charge = $paystack->charge->charge([
    'email' => 'test@example.com',
    'amount' => '1000000',
    'bank' => ['code' => '057', 'account_number' => '0000000000'],
    'birthday' => '1994-07-04',
]);
echo $charge->getLastResponse()->headers['Date'];
```

### Pagination

[](#pagination)

All services with a **list** endpoint support pagination and pagination parameters can be passed along to limit the result set.

```
$plans = $paystack->plans->all([
    'perPage' => 20,
    'page' => 2,
]);
```

#### Auto-Pagination

[](#auto-pagination)

List endpoints return an instance of a Paginator class which supports auto-pagination. This makes it easy to handle fetching multi page lists without having to manually paginate results and perform subsequent requests.

To use the auto-pagination feature, call `autoPagingIterator()` on the returned Paginator object to iterate over all objects matching your initial parameters.

```
$plans = $paystack->plans->all([
    'perPage' => 20,
    'page' => 2,
]);

foreach ($plans->autoPagingIterator() as $plan) {
  // Do something with $plan
}
```

### Webhooks

[](#webhooks)

Paystack uses webhooks to notify your application when transaction events occur on your integration. It is important to verify that events originate from Paystack to avoid delivering value based on a counterfeit event.

To verify a paystack event:

```
$input = @file_get_contents('php://input');
$paystack_signature = $_SERVER['HTTP_X_PAYSTACK_SIGNATURE'];

try {
    \Ayoolatj\Paystack\Webhook::verifyEvent($input, $paystack_signature, PAYSTACK_SECRET_KEY);
} catch (\Ayoolatj\Paystack\Exceptions\SignatureVerificationException $e) {
    $input = $e->getHttpBody();
    $header = $e->getSigHeader();

    exit();
}
```

Testing
-------

[](#testing)

```
vendor/bin/phpunit
```

TODOs
-----

[](#todos)

- Authorization Resource
- Roundup tests
- Metadata builder
- Clean up readme
- Non composer loader

###  Health Score

25

—

LowBetter than 35% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~1 days

Total

5

Last Release

2176d ago

PHP version history (2 changes)1.0.0PHP &gt;=7.2.5

1.1.0PHP &gt;=7.1.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1895357?v=4)[Tunji Ayoola](/maintainers/ayoolatj)[@ayoolatj](https://github.com/ayoolatj)

---

Top Contributors

[![ayoolatj](https://avatars.githubusercontent.com/u/1895357?v=4)](https://github.com/ayoolatj "ayoolatj (21 commits)")

---

Tags

subscriptiontransactionpaystackcustomerpaystack-php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/ayoolatj-paystack-php/health.svg)

```
[![Health](https://phpackages.com/badges/ayoolatj-paystack-php/health.svg)](https://phpackages.com/packages/ayoolatj-paystack-php)
```

###  Alternatives

[unicodeveloper/laravel-paystack

A Laravel Package for Paystack

6501.1M11](/packages/unicodeveloper-laravel-paystack)[yabacon/paystack-php

Helps make your Paystack API calls giving a stdClass object.

118459.7k16](/packages/yabacon-paystack-php)[eslazarev/wildberries-sdk

Wildberries OpenAPI clients (generated).

273.0k](/packages/eslazarev-wildberries-sdk)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
