Download the PHP package xentixar/khalti-sdk without Composer

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

KhaltiSdk PHP Library

The KhaltiSdk is a PHP library for integrating the Khalti payment gateway into your application. This library simplifies the process of initializing payments, validating transactions, and more.

Installation

To use this library, you'll need to include it in your project. You can install it via Composer. If you don't have Composer installed, you can download it from getcomposer.org.

Step-by-step Installation

  1. Install Composer:

  2. Add the package to your project:

  3. Include Composer's autoloader in your script:

Usage

Setting Up the Khalti Instance

Create a new instance of the Khalti class and set your secret key using the setSecretKey method. The secret key is required for authorization when making API requests.

Example Code

Configuration Details

The config method allows you to specify several parameters:

Initiating a Payment

The init method sends a request to the Khalti API to initiate the payment process. It handles the request server-side, and if the response contains a payment_url, it redirects the user to the Khalti payment page.

Note: For production, set the $production flag to true in the init method.

Validating a Transaction

To validate a transaction, use the validate method. This method sends a request to the Khalti API to check the status of a transaction.

Note: For production, set the $production flag to true in the validate method.

Decoding the Response

To decode the response data from Khalti:

Error Handling

The init method includes basic error handling for cURL requests. You may want to add additional error handling based on your application's requirements.

Contribution

Contributions are welcome! Please submit a pull request or create an issue to report bugs or request features.

License

This library is licensed under the MIT License. See the LICENSE file for more details.

Additional Resources


All versions of khalti-sdk with dependencies

PHP Build Version
Package Version
No informations.
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 xentixar/khalti-sdk contains the following files

Loading the files please wait ....