Download the PHP package midsonlajeanty/php-natcash-sdk without Composer

On this page you can find all versions of the php package midsonlajeanty/php-natcash-sdk. 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 php-natcash-sdk

Natcash Logo

Build Status Total Downloads Latest Stable Version License

Minimum SDK to process payment with Natcom Natcash Payment Gateway

Features

Getting started

Requires PHP 8.2+.

On PHP < 8.2? Pin the 1.x line, which supports PHP 7.4+:

Usage

Init Payment and get Payment URL (Natcash Checkout)

Get Transaction Details by Order ID

Common conventions (MonCash & NatCash)

The MonCash and NatCash SDKs share the same pattern. If you know one, you know the other:

Step Class / method
Configuration Config::from([...])
Instantiation new <Gateway>($config, $debug = true)
Request PaymentRequest::from([...])
Payment makePayment(PaymentRequest): PaymentResponse
Redirect $response->getRedirect()
Details getTransactionDetailsByOrderId($orderId): TransactionDetails
Result $details->getOrderId(), getTransactionId(), getAmount(), getPayer(), isSuccessful()

NatCash-specific features: HMAC signatures (verifyPayloadSignature()), getMsisdn(), skipPhoneInput.

Laravel

The package auto-registers a service provider and a facade (Laravel 9 to 13). Publish the config file:

Set your credentials in .env (they are loaded automatically):

Then use the facade, or inject NatcashInterface (both resolve the same configured singleton):

Testing

The Natcash gateway is final (it is the only class that performs I/O), so it cannot be mocked directly. Instead, type-hint your application code against NatcashInterface and mock the interface:

Value objects (Config, PaymentRequest, PaymentResponse, TransactionDetails) are also final - don't mock them, just construct them with test data.

Contributing

You have a lot of options to contribute to this project ! You can :


All versions of php-natcash-sdk with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
guzzlehttp/guzzle Version ^7.8 || ^8.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 midsonlajeanty/php-natcash-sdk contains the following files

Loading the files please wait ...