PHPackages                             getsafepay/safepay-php - 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. getsafepay/safepay-php

ActiveLibrary[Payment Processing](/categories/payments)

getsafepay/safepay-php
======================

Official PHP SDK for Safepay Checkout

v1.0.0(3y ago)31.3k12MITPHPPHP &gt;=7.4

Since Jul 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/getsafepay/safepay-php)[ Packagist](https://packagist.org/packages/getsafepay/safepay-php)[ RSS](/packages/getsafepay-safepay-php/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)DependenciesVersions (3)Used By (2)

Safepay PHP SDK
===============

[](#safepay-php-sdk)

Official PHP SDK for [Safepay API](https://getsafepay.com/).

Installation
============

[](#installation)

```
composer require getsafepay/safepay-php

```

Usage
=====

[](#usage)

Import and create a Safepay client by passing your config;

```
use Safepay\Safepay;

$config = [
	"environment" =>'sandbox',
	"apiKey" => 'sec_e9273e07a7ac',
	"v1Secret" =>  'a73e5dad7cd8b1e7fea2f6d93f4c8',
	"webhookSecret" =>  '14509fdd8591a60427e'
];

$Safepay = new Safepay($config);

```

You can now create payments and checkout links.

Payments
========

[](#payments)

```

$response = $Safepay->payments->getToken(['amount'=>1000,'currency'=>'PKR']);

//$response['token'];
// Pass `token` to create checkout link

```

Checkout
========

[](#checkout)

Create checkout link.

For mobile, set the `source` to `mobile` as opposed to `custom` in the payload. You also do not need to pass a `success_url` or a `cancel_url`.

```
$link = $Safepay->checkout->create([
	"token" => $response['token'],
	"order_id" => 234,
	"source"=>'custom',
	"webhooks"=>'true',
	"success_url" =>"url /success.php",
	"cancel_url" => "url  /cancel.php"
]);

//redirect user to url
if( $link['result'] == 'success' ) {
	header('Location:'.$link['redirect']);
}

```

Verification
============

[](#verification)

Signature verification on success page.

```

$tracker = $_POST['tracker'];

$signature = $_POST['sig'];

if( $Safepay->verify->signature($tracker,$signature)  === true) {

	//Signature is valid
}

```

Webhook
=======

[](#webhook)

Signature verification of Webhook post request

```
$X_SFPY_SIGNATURE = @$_SERVER['HTTP_X_SFPY_SIGNATURE'];

$data = file_get_contents('php://input');

if( $Safepay->verify->webhook($data,$X_SFPY_SIGNATURE)  === true) {

	//Web Hook request is valid
}

```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance27

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 73.5% 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 ~46 days

Total

2

Last Release

1360d ago

Major Versions

v0.0.1 → v1.0.02022-08-18

### Community

Maintainers

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

---

Top Contributors

[![matiullah31](https://avatars.githubusercontent.com/u/9604691?v=4)](https://github.com/matiullah31 "matiullah31 (25 commits)")[![ziyadparekh](https://avatars.githubusercontent.com/u/4661481?v=4)](https://github.com/ziyadparekh "ziyadparekh (7 commits)")[![devzaidi](https://avatars.githubusercontent.com/u/75736041?v=4)](https://github.com/devzaidi "devzaidi (2 commits)")

### Embed Badge

![Health badge](/badges/getsafepay-safepay-php/health.svg)

```
[![Health](https://phpackages.com/badges/getsafepay-safepay-php/health.svg)](https://phpackages.com/packages/getsafepay-safepay-php)
```

###  Alternatives

[omnipay/paypal

PayPal gateway for Omnipay payment processing library

3156.8M53](/packages/omnipay-paypal)[eduardokum/laravel-boleto

Biblioteca com boletos para o laravel

626351.9k2](/packages/eduardokum-laravel-boleto)[tbbc/money-bundle

This is a Symfony bundle that integrates moneyphp/money library (Fowler pattern): https://github.com/moneyphp/money.

1961.9M](/packages/tbbc-money-bundle)[2checkout/2checkout-php

2Checkout PHP Library

83740.3k2](/packages/2checkout-2checkout-php)[smhg/sepa-qr-data

Generate QR code data for SEPA payments

61717.2k5](/packages/smhg-sepa-qr-data)[omnipay/dummy

Dummy driver for the Omnipay payment processing library

271.2M33](/packages/omnipay-dummy)

PHPackages © 2026

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