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

ActiveLibrary[Payment Processing](/categories/payments)

shift4/shift4-php
=================

Shift4 PHP Library

v4.0.0(1y ago)4105.6k↓13.6%9[1 issues](https://github.com/shift4developer/shift4-php/issues)[1 PRs](https://github.com/shift4developer/shift4-php/pulls)MITPHPPHP &gt;=5.5CI passing

Since Nov 3Pushed 1y ago3 watchersCompare

[ Source](https://github.com/shift4developer/shift4-php)[ Packagist](https://packagist.org/packages/shift4/shift4-php)[ Docs](https://dev.shift4.com/)[ RSS](/packages/shift4-shift4-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (9)Dependencies (1)Versions (10)Used By (0)

Shift4 PHP Library
==================

[](#shift4-php-library)

If you don't already have Shift4 account you can create it [here](https://dev.shift4.com/signup).

Installation
------------

[](#installation)

### Composer

[](#composer)

Best way to use this library is via [Composer](http://getcomposer.org/).

```
composer require shift4/shift4-php

```

Then to use the library, you can use Composer's autoloader:

```
require_once('vendor/autoload.php');
```

### Manual installation

[](#manual-installation)

If you don't want to use Composer then you can download [the latest release](https://github.com/shift4developer/shift4-php/releases).

Then to use the library, you can either configure your autoloader to load classes from the `lib/` directory or use included autoloader:

```
 require_once 'lib/Shift4/Util/Shift4Autoloader.php';
 \Shift4\Util\Shift4Autoloader::register();
```

Quick start example
-------------------

[](#quick-start-example)

```
use Shift4\Shift4Gateway;
use Shift4\Exception\Shift4Exception;

$gateway = new Shift4Gateway('sk_test_[YOUR_SECRET_KEY]');

$request = [
    'amount' => 499,
    'currency' => 'EUR',
    'card' => [
        'number' => '4242424242424242',
        'expMonth' => 11,
        'expYear' => 2022
    ]
];

try {
    $charge = $gateway->createCharge($request);

    // do something with charge object - see https://dev.shift4.com/docs/api#charge-object
    $chargeId = $charge->getId();

} catch (Shift4Exception $e) {
    // handle error response - see https://dev.shift4.com/docs/api#error-object
    $errorType = $e->getType();
    $errorCode = $e->getCode();
    $errorMessage = $e->getMessage();
}
```

Documentation
-------------

[](#documentation)

For further information, please refer to our official documentation at .

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance42

Moderate activity, may be stable

Popularity39

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~112 days

Total

9

Last Release

391d ago

Major Versions

v1.0.0 → v2.0.02023-03-07

v2.1.0 → v3.0.02023-11-08

v3.3.0 → v4.0.02025-04-23

PHP version history (2 changes)v1.0.0PHP &gt;=5.4.0

v2.0.0PHP &gt;=5.5

### Community

Maintainers

![](https://www.gravatar.com/avatar/0988fba1b5e4551e9069842a71f6664398ef6569b72871857961b77541065784?d=identicon)[shift4](/maintainers/shift4)

---

Top Contributors

[![mguzowski-shift4](https://avatars.githubusercontent.com/u/147831471?v=4)](https://github.com/mguzowski-shift4 "mguzowski-shift4 (13 commits)")[![el-dot](https://avatars.githubusercontent.com/u/7493083?v=4)](https://github.com/el-dot "el-dot (9 commits)")[![hopeseekr](https://avatars.githubusercontent.com/u/1125541?v=4)](https://github.com/hopeseekr "hopeseekr (6 commits)")[![mschielmann](https://avatars.githubusercontent.com/u/11925769?v=4)](https://github.com/mschielmann "mschielmann (2 commits)")[![jsshift4](https://avatars.githubusercontent.com/u/144910082?v=4)](https://github.com/jsshift4 "jsshift4 (1 commits)")[![mjancewicz](https://avatars.githubusercontent.com/u/576099?v=4)](https://github.com/mjancewicz "mjancewicz (1 commits)")[![Shift4-Team](https://avatars.githubusercontent.com/u/12641508?v=4)](https://github.com/Shift4-Team "Shift4-Team (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/shift4-shift4-php/health.svg)](https://phpackages.com/packages/shift4-shift4-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)
