PHPackages                             balerka/laravel-payhub - 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. balerka/laravel-payhub

ActiveLibrary[Payment Processing](/categories/payments)

balerka/laravel-payhub
======================

Reusable Laravel payment foundation with headless endpoints and embeddable React components.

v0.2(1mo ago)01MITPHPPHP ^8.3

Since May 6Pushed 1mo agoCompare

[ Source](https://github.com/Balerka/laravel-payhub)[ Packagist](https://packagist.org/packages/balerka/laravel-payhub)[ RSS](/packages/balerka-laravel-payhub/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (2)Dependencies (9)Versions (3)Used By (0)

Laravel Payhub
==============

[](#laravel-payhub)

Reusable payment foundation for Laravel applications.

It provides:

- Laravel models for cards, orders, transactions, and subscriptions.
- Migrations and configurable table names.
- Auth-protected JSON endpoints for custom frontends.
- Embeddable React components for checkout and payment card management.
- A local test payment endpoint for development.

Install
-------

[](#install)

```
composer require balerka/laravel-payhub
php artisan vendor:publish --tag=payhub-config
php artisan vendor:publish --tag=payhub-migrations
php artisan migrate
```

For local development from this repository:

```
{
  "repositories": [
    {
      "type": "path",
      "url": "../laravel-payhub"
    }
  ]
}
```

Then run:

```
composer require balerka/laravel-payhub:@dev
```

Frontend Components
-------------------

[](#frontend-components)

Payhub does not register checkout or cards page routes. Publish the React assets and embed the exported components in your own pages:

```
composer require inertiajs/inertia-laravel
php artisan vendor:publish --tag=payhub-react
```

The React files publish to:

```
resources/js/pages/payhub

```

Example:

```
import { Checkout, PaymentCards, PayhubRefunds, PayhubSubscriptions } from '@/pages/payhub'
```

Basic usage:

```

```

Payhub does not manage products or catalogs. Your application owns product selection and passes payment details into `Checkout`:

- `amount` - required payment amount
- `currency` - optional ISO currency code, defaults to `PAYHUB_CURRENCY`
- `description` - optional text sent to the gateway
- `receipt` - optional full receipt object with `items`, `email`, `amounts`, `currency`, `description`, and any gateway-specific receipt data
- `items` - shorthand for `receipt.items` if you do not need to pass the full receipt object

Payhub ships with embedded English and Russian dictionaries inside the published React files, so the component can pick its own translations from `locale` without touching host project files.

Translations
------------

[](#translations)

If the host project wants to reuse the same strings in its own i18n system, publish the standalone dictionaries too:

```
php artisan vendor:publish --tag=payhub-locales
```

This creates:

```
resources/js/locales/en/payhub.json
resources/js/locales/ru/payhub.json

```

Payhub does not edit host project files. The host app can either:

- let the components localize themselves from `locale`
- import `payhub.json` directly and pass `messages` overrides when needed
- load `payhub.json` into its own i18n system if it already has one
- do nothing and use the built-in English fallback messages

Checkout example:

```
import { Checkout } from '@/pages/payhub'

export default function CheckoutPage() {
  return (

  )
}
```

Override example:

```
import { Checkout } from '@/pages/payhub'
import ruPayhub from '@/locales/ru/payhub.json'

```

Routes
------

[](#routes)

Routes are registered with the `payhub.` name prefix and use `/payhub` as the default URL prefix:

- `GET /payhub/cards/data` returns cards as JSON.
- `GET /payhub/checkout/data` returns gateway metadata and saved cards as JSON.
- `POST /payhub/checkout/orders` creates a pending order from `amount`, `currency`, `description`, and optional `receipt`. Payhub stores the full receipt object on the order. When `card_id` is passed with the `cloud_payments` gateway, Payhub charges that saved card token through CloudPayments.
- `DELETE /payhub/checkout/orders/{order}` cancels a pending order.
- `PUT /payhub/cards/default` sets the default card.
- `DELETE /payhub/cards/{card}` deletes a card owned by the current user.
- `GET /payhub/subscriptions/data` returns subscriptions owned by the current user.
- `POST /payhub/subscriptions/cancel` cancels a current user's CloudPayments subscription.
- `GET /payhub/refunds/data` returns refundable payment transactions owned by the current user.
- `POST /payhub/refunds/refund` refunds or voids a current user's CloudPayments payment transaction.
- `POST /payhub/payments/test/pay` creates a local test payment when `payhub.test_mode=true`.

For checkout, cards, subscriptions, and refunds UI, publish the React assets and embed `Checkout`, `PaymentCards`, `PayhubSubscriptions`, or `PayhubRefunds` in any application page. Payhub does not register page routes for these components. For a custom frontend, call the JSON endpoints directly and send `Accept: application/json` when you want JSON responses from mutation endpoints.

Configuration
-------------

[](#configuration)

`config/payhub.php` controls route middleware, table names, user model, currency, test mode, and gateway metadata.

Set checkout currency with:

```
PAYHUB_CURRENCY=RUB
```

Select the active gateway with:

```
PAYHUB_GATEWAY=test
```

The published checkout component supports the `test` gateway and CloudPayments widget flow. When the current user has saved cards, the checkout component lists them, selects the default card, and sends the selected `card_id` for saved-card payment. Users can still choose a new-card payment, which opens the CloudPayments widget.

For CloudPayments:

```
PAYHUB_GATEWAY=cloud_payments
CP_PUBLIC_ID=pk_...
CP_SECRET=...
```

Configure CloudPayments callbacks to:

```
POST /payhub/payments/cloud-payments/check
POST /payhub/payments/cloud-payments/pay
POST /payhub/payments/cloud-payments/fail

```

The callbacks are protected with the CloudPayments `Content-HMAC` signature.

To reuse the table names from an existing app, set:

```
PAYHUB_CARDS_TABLE=cards
PAYHUB_ORDERS_TABLE=orders
PAYHUB_TRANSACTIONS_TABLE=transactions
PAYHUB_SUBSCRIPTIONS_TABLE=subscriptions
```

Only `PAYHUB_*` environment variables are supported.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance93

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 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 ~0 days

Total

2

Last Release

34d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/78909936?v=4)[Balerka](/maintainers/Balerka)[@Balerka](https://github.com/Balerka)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/balerka-laravel-payhub/health.svg)

```
[![Health](https://phpackages.com/badges/balerka-laravel-payhub/health.svg)](https://phpackages.com/packages/balerka-laravel-payhub)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3325.1M337](/packages/psalm-plugin-laravel)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9732.3M121](/packages/roots-acorn)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1232.2k16](/packages/fleetbase-core-api)[laravel/cashier-paddle

Cashier Paddle provides an expressive, fluent interface to Paddle's subscription billing services.

268880.7k3](/packages/laravel-cashier-paddle)[api-platform/laravel

API Platform support for Laravel

59156.3k10](/packages/api-platform-laravel)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)

PHPackages © 2026

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