pagocards/php-laravel
Composer 安装命令:
composer require pagocards/php-laravel
包简介
Official PHP Laravel SDK for Pagocards card issuance and wallet APIs
README 文档
README
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
- 🚀 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
- PHP 8.1 or higher
- Laravel 8.0 or higher
- Composer
- Guzzle HTTP client (installed via Composer)
Installation
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
When the package is available on Packagist:
composer require pagocards/php-laravel:^1.0
Configuration
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
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.
Usage
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
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
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
Cards
Create Mastercard
Pagocards::createMastercard([ 'email' => 'user@example.com', 'firstname' => 'John', 'lastname' => 'Doe' ])
Create Visa Card
Pagocards::createVisacard([ 'email' => 'user@example.com', 'firstname' => 'John', 'lastname' => 'Doe' ])
Get Card Details
Pagocards::getCard('card_id', 'visacard'); // or Pagocards::getCard('card_id', 'mastercard');
List Cards
Pagocards::listCards('visacard', $page = 1, $perPage = 50);
Fund Visa Card
Pagocards::fundVisacard('card_id', 100.00);
Block Mastercard
Pagocards::toggleCard('card_id', 'block', 'mastercard');
Unblock Mastercard
Pagocards::toggleCard('card_id', 'unblock', 'mastercard');
Wallet
Get Wallet Balance
$balance = Pagocards::getBalance(); // Returns: ['issuance_balance' => 100, 'funding_balance' => 500]
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
Change Base URL
Pagocards::setBaseUrl('https://pagocards.com');
Get Current Base URL
$url = Pagocards::getBaseUrl();
Testing
Run tests with:
composer test
Generate coverage report:
composer test-coverage
Coverage reports will be generated in the coverage/ directory.
Development
Clone the Repository
git clone https://github.com/pagocards/php-laravel.git
cd php-laravel
Install Dependencies
composer install
Run Tests
composer test
Build and Contribute
- Create a feature branch
- Make your changes
- Write tests for new features
- Ensure all tests pass
- Submit a pull request
Troubleshooting
"Could not resolve: api"
This error typically means the request is being sent to an invalid URL. Ensure:
PAGOCARDS_API_URLis 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"
This error occurs when making API calls without proper authentication. Ensure:
PAGOCARDS_PUBLIC_KEYandPAGOCARDS_SECRET_KEYare set in.env- These keys are valid and not expired
"Incorrect column count"
If you're experiencing data issues, ensure:
- Your API response format matches expectations
- Your API keys have proper permissions
Documentation
For complete documentation and API reference, visit:
Support
For support and questions:
- Email: support@pagocards.com
- Website: https://pagocards.com
- GitHub Issues: github.com/pagocards/php-laravel/issues
License
This SDK is open-sourced software licensed under the MIT License.
Changelog
See CHANGELOG.md for a list of changes in each version.
Contributing
Thank you for considering contributing! Please see CONTRIBUTING.md for details.
Pagocards: Transform your financial products with our robust card issuance platform.
pagocards/php-laravel 适用场景与选型建议
pagocards/php-laravel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 04 月 06 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「api」 「laravel」 「visa」 「mastercard」 「virtual-cards」 「card-issuance」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 pagocards/php-laravel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 pagocards/php-laravel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 pagocards/php-laravel 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Laravel >=5.6 integration for the PHP Credit Cards package that allows to perform operations on debit and credit cards like format, validate brand, number and Luhn algorithm.
Client SDK for CyberSource REST APIs
A PSR-7 compatible library for making CRUD API endpoints
PHP library for working with Georgian payment providers and banks
Laravel Blade components for SVG credit card and payment icons
DigiWallet Bank Payments PHP SDK
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 35
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-06