Download the PHP package astrasoftwares/astrapay without Composer

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


AstraPay PHP SDK

AstraPay is a lightweight PHP SDK that simplifies integrating Safaricom M-Pesa STK Push, C2B (Customer to Business), and B2C (Business to Customer) APIs into your web applications. Built and maintained by Astra Softwares, this SDK allows you to initiate secure mobile payments and disbursements with ease.


📦 Installation

Install via Composer:

Requires PHP >= 7.4


⚙️ Configuration

Initialize the client with your credentials. Depending on the service you are using (STK, C2B, or B2C), different keys are required.


🚀 Usage Examples

1. STK Push (M-Pesa Express)

Initiate a payment prompt on the customer's phone.

2. C2B (Customer to Business)

Handle payments sent directly to your Paybill/Till via the SIM toolkit.

Step A: Register URLs (Run Once) You must tell Safaricom where to send validation and confirmation data.

Step B: Simulate C2B (Sandbox Only) Since you cannot use real money in Sandbox, use this to test your confirmation URLs.

3. B2C (Business to Customer)

Send money from your business account to a user (e.g., Salaries, Refunds).


🔐 How to Get M-Pesa API Credentials

To integrate with M-Pesa, you’ll need to create a Safaricom Daraja developer account:

  1. Register on Daraja Portalhttps://developer.safaricom.co.ke
  2. Create an App

    • Log in and click “My Apps” → “Add a New App”
    • Ensure you check the boxes for:
    • Lipa na M-Pesa Sandbox (for STK)
    • M-Pesa Sandbox (for C2B/B2C)
  3. Get your Credentials:
    • Consumer Key & Secret: Found in your App dashboard.
    • Passkey: Generated via the "Simulate" tab in Daraja or sent via email in production.
    • Security Credential (B2C Only): This is an encrypted password. In Sandbox, Safaricom provides a test credential. In Production, you must generate it using the M-Pesa Public Certificate.

🧲 Sample Test Numbers (Sandbox)

Phone Number PIN OTP
254708374149 1111 123456

Use the sandbox environment for development/testing. When moving to production (env => 'live'), ensure your Shortcode is active and approved by Safaricom.


📖 Documentation


🤝 Contribute

Pull requests are welcome! If you find a bug or want a feature added, open an issue or submit a PR.


🧑‍💻 Author

Built with ❤️ by Ishmael Bett 📧 [email protected]


📄 License

This project is licensed under the MIT License.


All versions of astrapay with dependencies

PHP Build Version
Package Version
Requires php Version >=7.4
ext-curl Version *
ext-json Version *
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 astrasoftwares/astrapay contains the following files

Loading the files please wait ...