Download the PHP package gokulsingh/laravel-payhub without Composer

On this page you can find all versions of the php package gokulsingh/laravel-payhub. 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 laravel-payhub

Laravel PayHub — Step-by-step Guide (Beginner Friendly)

A unified payment wrapper for Laravel supporting Razorpay and Cashfree. It provides a consistent API: create orders, charge, refund, verify webhooks, store optional logs, and attach custom metadata per order.


Table of contents

  1. Getting started (Install)
  2. Publish config & migrations
  3. Configure .env
  4. Quick examples (backend)
  5. Checkout integration (frontend)

    • Razorpay (Checkout.js)
    • Cashfree (Hosted link or Drop-in)
  6. Success callback (route + controller + verify)
  7. Webhook integration (route + verify)
  8. Metadata (custom data per order)
  9. Optional DB logging (disable/enable)
  10. Unit tests
  11. Troubleshooting & FAQ
  12. Extending with a new gateway
  13. License

1 — Getting started (Install)

Option A — Install from Packagist (recommended when published)

Option B — Local development (path repository)

If you keep the package in your app under packages/gokulsingh/laravel-payhub, add to your app composer.json:

Then run:

Laravel supports package auto-discovery — no manual provider registration needed.


2 — Publish config & migrations

Publish config + migration files into your Laravel app:

If you want DB logging, run:

Note: If you don’t want the payment_transactions table, skip the migrations publish and migrate step — see "Optional DB logging" below.


3 — Configure .env

Add credentials and options to your .env:

Open config/payment.php (published) to confirm settings.

Important — Amount units


4 — Quick backend examples

Use the package via the Payment facade.

Create an order using the default gateway

Explicit gateway

Charge / verify a payment

Refund


5 — Checkout integration (frontend)

After you create an order in backend, integrate frontend to complete payment.

A — Razorpay (Checkout.js)

Backend: create order and return JSON.

Frontend:

Notes:


B — Cashfree

Backend: create order

Option 1 — Redirect to hosted payment link If createOrder() returns a payment_link (or in raw), simply redirect:

Option 2 — Cashfree Drop-in

Notes:


6 — Success callback (server side verification)

Add a route:

Create controller:

This uses the package charge() method which calls the gateway API and returns normalized result.


7 — Webhook integration (automatic route + verification)

Publish routes with the package route macro:

The package WebhookController will:

If you need custom behavior, extend WebhookController or listen to the package events:

Manual verification example (Razorpay):


8 — Custom metadata (attach any data you want)

When creating orders, pass metadata array — it will be:

Use metadata to store app-specific IDs, tracking info, coupons, etc.


9 — Optional DB logging

By default the package logs transactions into payment_transactions. You can disable this:

Disable:

If disabled:

If enabled later:

Migration fields typically include: gateway, type, status, amount, currency, transaction_id, payload (json), created_at.


10 — Unit tests

The package includes PHPUnit tests (feature tests). Run them from your application:

Suggested tests:

When testing, mock HTTP client responses to avoid hitting real APIs.


11 — Troubleshooting & FAQ

Q: Class not found after composer install? A: Run composer dump-autoload and ensure package composer.json psr-4 namespace matches your src/ namespaces.

Q: No publishable resources when vendor\:publish? A: Verify you used the correct tag --tag=config and --tag=migrations (plural). Check the package provider namespace matches installed package.

Q: Amount mismatches (Razorpay shows ×100)? A: Pass amount in main currency unit (₹). The package converts for Razorpay internally.

Q: Webhook signature verification failing? A: Make sure RAZORPAY_SECRET / CASHFREE_SECRET are correct, and that your webhook body is the exact raw JSON used to compute the HMAC. When testing locally, use ngrok to forward webhooks.


12 — Extending (Add a new gateway)

  1. Implement Gokulsingh\LaravelPayhub\Contracts\GatewayInterface.
  2. Use BaseGateway & BaseNormalizer for consistent behavior.
  3. Register gateway in your Payment manager (or modify Payment::useGateway switch).
  4. Add config values in config/payment.php.

13 — Contributing & License



All versions of laravel-payhub with dependencies

PHP Build Version
Package Version
Requires php Version ^8.1
illuminate/support Version ^10.0|^11.0
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 gokulsingh/laravel-payhub contains the following files

Loading the files please wait ...