PHPackages                             pagocards/php-laravel - 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. [API Development](/categories/api)
4. /
5. pagocards/php-laravel

ActiveLibrary[API Development](/categories/api)

pagocards/php-laravel
=====================

Official PHP Laravel SDK for Pagocards card issuance and wallet APIs

v1.0.1(2mo ago)01MITPHPPHP ^8.1CI passing

Since Apr 6Pushed 2mo agoCompare

[ Source](https://github.com/pagocards/php-laravel)[ Packagist](https://packagist.org/packages/pagocards/php-laravel)[ Docs](https://github.com/pagocards/php-laravel)[ RSS](/packages/pagocards-php-laravel/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (1)Dependencies (4)Versions (3)Used By (0)

Pagocards PHP Laravel SDK
=========================

[](#pagocards-php-laravel-sdk)

[![CI](https://github.com/pagocards/php-laravel/actions/workflows/ci.yml/badge.svg)](https://github.com/pagocards/php-laravel/actions/workflows/ci.yml)[![Latest Version](https://camo.githubusercontent.com/6f9fab99f6a5da865df3f001c7116eef79df8a46c985765546f55ce7ac5d1229/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f7061676f63617264732f7068702d6c61726176656c)](https://github.com/pagocards/php-laravel/releases)[![License](https://camo.githubusercontent.com/074b89bca64d3edc93a1db6c7e3b1636b874540ba91d66367c0e5e354c56d0ea/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e737667)](LICENSE)[![PHP Version](https://camo.githubusercontent.com/acffb6ae1962992d26e4466782832787e79504a6250f80d732c4283458b9f497/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253545382e312d626c75652e737667)](https://www.php.net/)

The official PHP SDK for **Pagocards** - A powerful card issuance and virtual wallet platform. This SDK allows you to easily integrate Pagocards services into your Laravel applications.

Features
--------

[](#features)

- 🚀 Easy-to-use API client for Pagocards
- 💳 Create and manage Mastercard and Visa cards
- 💰 Fund cards and check wallet balances
- 🔐 Secure authentication with public/secret keys
- 📦 Laravel Service Provider integration
- ✅ Full test coverage
- 📝 Comprehensive documentation

Requirements
------------

[](#requirements)

- PHP 8.1 or higher
- Laravel 8.0 or higher
- Composer
- Guzzle HTTP client (installed via Composer)

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

[](#installation)

### Via Composer (From GitHub)

[](#via-composer-from-github)

```
composer config repositories.pagocards vcs https://github.com/pagocards/php-laravel
composer require pagocards/php-laravel:^1.0
```

Or add to your `composer.json`:

```
{
  "repositories": [
    {
      "type": "vcs",
      "url": "https://github.com/pagocards/php-laravel"
    }
  ],
  "require": {
    "pagocards/php-laravel": "^1.0"
  }
}
```

Then run:

```
composer install
```

### From Released Package

[](#from-released-package)

When the package is available on Packagist:

```
composer require pagocards/php-laravel:^1.0
```

Configuration
-------------

[](#configuration)

### 1. Publish Configuration File

[](#1-publish-configuration-file)

```
php artisan vendor:publish --provider="Pagocards\SDK\ServiceProvider" --tag="config"
```

This creates `config/pagocards.php` in your Laravel project.

### 2. Set Environment Variables

[](#2-set-environment-variables)

Add the following to your `.env` file:

```
PAGOCARDS_PUBLIC_KEY=your_public_key_here
PAGOCARDS_SECRET_KEY=your_secret_key_here
PAGOCARDS_API_URL=https://pagocards.com
PAGOCARDS_DEBUG=false
```

You can get your API keys from your [Pagocards Dashboard](https://pagocards.com/settings/developer).

Usage
-----

[](#usage)

### Using the Facade

[](#using-the-facade)

```
use Pagocards\SDK\Facades\Pagocards;

// Create a Mastercard
$card = Pagocards::createMastercard([
    'email' => 'user@example.com',
    'firstname' => 'John',
    'lastname' => 'Doe'
]);

// Create a Visa Card
$card = Pagocards::createVisacard([
    'email' => 'user@example.com',
    'firstname' => 'John',
    'lastname' => 'Doe'
]);

// Fund a Visa Card
$result = Pagocards::fundVisacard('card_id', 100.00);

// Get card details
$card = Pagocards::getCard('card_id', 'visacard');

// List cards
$cards = Pagocards::listCards('visacard', 1, 50);

// Block/Unblock Mastercard
Pagocards::toggleCard('card_id', 'block', 'mastercard');
Pagocards::toggleCard('card_id', 'unblock', 'mastercard');

// Get wallet balance
$balance = Pagocards::getBalance();
```

### Direct Client Usage

[](#direct-client-usage)

```
use Pagocards\SDK\Client;

$client = new Client(
    'your_public_key',
    'your_secret_key',
    'https://pagocards.com'
);

// Use all the same methods as the facade
$card = $client->createVisacard([
    'email' => 'user@example.com',
    'firstname' => 'John',
    'lastname' => 'Doe'
]);
```

### In Service Classes or Controllers

[](#in-service-classes-or-controllers)

```
namespace App\Services;

use Pagocards\SDK\Facades\Pagocards;

class CardService
{
    public function createUserCard($email, $firstname, $lastname)
    {
        try {
            $card = Pagocards::createVisacard([
                'email' => $email,
                'firstname' => $firstname,
                'lastname' => $lastname
            ]);

            return $card;
        } catch (\Exception $e) {
            \Log::error('Card creation failed: ' . $e->getMessage());
            throw $e;
        }
    }
}
```

API Methods
-----------

[](#api-methods)

### Cards

[](#cards)

#### Create Mastercard

[](#create-mastercard)

```
Pagocards::createMastercard([
    'email' => 'user@example.com',
    'firstname' => 'John',
    'lastname' => 'Doe'
])
```

#### Create Visa Card

[](#create-visa-card)

```
Pagocards::createVisacard([
    'email' => 'user@example.com',
    'firstname' => 'John',
    'lastname' => 'Doe'
])
```

#### Get Card Details

[](#get-card-details)

```
Pagocards::getCard('card_id', 'visacard');
// or
Pagocards::getCard('card_id', 'mastercard');
```

#### List Cards

[](#list-cards)

```
Pagocards::listCards('visacard', $page = 1, $perPage = 50);
```

#### Fund Visa Card

[](#fund-visa-card)

```
Pagocards::fundVisacard('card_id', 100.00);
```

#### Block Mastercard

[](#block-mastercard)

```
Pagocards::toggleCard('card_id', 'block', 'mastercard');
```

#### Unblock Mastercard

[](#unblock-mastercard)

```
Pagocards::toggleCard('card_id', 'unblock', 'mastercard');
```

### Wallet

[](#wallet)

#### Get Wallet Balance

[](#get-wallet-balance)

```
$balance = Pagocards::getBalance();
// Returns: ['issuance_balance' => 100, 'funding_balance' => 500]
```

Error Handling
--------------

[](#error-handling)

All methods throw an `\Exception` on failure. The exception message contains the API error message.

```
try {
    $card = Pagocards::createVisacard([
        'email' => 'invalid-email',
        'firstname' => 'John',
        'lastname' => 'Doe'
    ]);
} catch (\Exception $e) {
    echo "Error: " . $e->getMessage();
    echo "Code: " . $e->getCode();
}
```

Configuration
-------------

[](#configuration-1)

### Change Base URL

[](#change-base-url)

```
Pagocards::setBaseUrl('https://pagocards.com');
```

### Get Current Base URL

[](#get-current-base-url)

```
$url = Pagocards::getBaseUrl();
```

Testing
-------

[](#testing)

Run tests with:

```
composer test
```

Generate coverage report:

```
composer test-coverage
```

Coverage reports will be generated in the `coverage/` directory.

Development
-----------

[](#development)

### Clone the Repository

[](#clone-the-repository)

```
git clone https://github.com/pagocards/php-laravel.git
cd php-laravel
```

### Install Dependencies

[](#install-dependencies)

```
composer install
```

### Run Tests

[](#run-tests)

```
composer test
```

### Build and Contribute

[](#build-and-contribute)

1. Create a feature branch
2. Make your changes
3. Write tests for new features
4. Ensure all tests pass
5. Submit a pull request

Troubleshooting
---------------

[](#troubleshooting)

### "Could not resolve: api"

[](#could-not-resolve-api)

This error typically means the request is being sent to an invalid URL. Ensure:

- `PAGOCARDS_API_URL` is set correctly in `.env`
- The base URL is the full domain (e.g., `https://pagocards.com`)

### "An email must have a "To", "Cc", or "Bcc" header"

[](#an-email-must-have-a-to-cc-or-bcc-header)

This error occurs when making API calls without proper authentication. Ensure:

- `PAGOCARDS_PUBLIC_KEY` and `PAGOCARDS_SECRET_KEY` are set in `.env`
- These keys are valid and not expired

### "Incorrect column count"

[](#incorrect-column-count)

If you're experiencing data issues, ensure:

- Your API response format matches expectations
- Your API keys have proper permissions

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

[](#documentation)

For complete documentation and API reference, visit:

- [Pagocards Documentation](https://docs.pagocards.com)
- [API Reference](https://pagocards.com/api/docs)
- [Dashboard](https://pagocards.com/dashboard)

Support
-------

[](#support)

For support and questions:

- Email:
- Website:
- GitHub Issues: [github.com/pagocards/php-laravel/issues](https://github.com/pagocards/php-laravel/issues)

License
-------

[](#license)

This SDK is open-sourced software licensed under the [MIT License](LICENSE).

Changelog
---------

[](#changelog)

See [CHANGELOG.md](CHANGELOG.md) for a list of changes in each version.

Contributing
------------

[](#contributing)

Thank you for considering contributing! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

---

**Pagocards**: Transform your financial products with our robust card issuance platform.

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance87

Actively maintained with recent releases

Popularity1

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

64d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bf11a3f2a6dea01d6a313ee430a009b2013b50915e8fd4b2262404325bc02663?d=identicon)[pagocardsllc](/maintainers/pagocardsllc)

---

Top Contributors

[![pagocards](https://avatars.githubusercontent.com/u/273919501?v=4)](https://github.com/pagocards "pagocards (4 commits)")

---

Tags

apilaravelvisamastercardvirtual cardscard-issuancepagocards

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[smodav/mpesa

M-Pesa API implementation

16167.1k1](/packages/smodav-mpesa)[simplestats-io/laravel-client

Analytics for Laravel. Track visitors, registrations, and payments. Discover which channels actually drive revenue, not just traffic. Server-side, GDPR compliant, ad-blocker proof.

5019.3k](/packages/simplestats-io-laravel-client)[files.com/files-php-sdk

Files.com PHP SDK

2478.1k](/packages/filescom-files-php-sdk)

PHPackages © 2026

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