Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Php Sdk V2 Laravel Package

mangopay/php-sdk-v2

PHP SDK for the MANGOPAY REST API v2.01+. Provides a client to authenticate and interact with MANGOPAY endpoints (payments, users, wallets, transfers, etc.). Install via Composer (mangopay4/php-sdk). Requires PHP 5.6+, cURL, OpenSSL.

View on GitHub
Deep Wiki
Context7

At a glance

Frequently asked questions about Php Sdk V2
How do I install the Mangopay PHP SDK in a Laravel project?
Run `composer require mangopay4/php-sdk` in your project root. The SDK requires PHP 5.6+ (though Laravel 10+ needs PHP 8.1+), cURL, and OpenSSL. Ensure your `composer.json` includes the dependency, then autoload it via Laravel’s Composer autoloader.
Does this SDK support Laravel’s service container for dependency injection?
Yes. Register the `MangoPayApi` class in your Laravel service provider (e.g., `MangoPayServiceProvider`) using `app->bind()` or `app->singleton()`. Bind it to a config-driven instance with environment variables (e.g., `.env` for API keys and sandbox/production mode).
How do I handle OAuth2 authentication in Laravel with this SDK?
Configure the SDK’s `TemporaryFolder` for token storage in `config/mangopay.php`. For shared hosting or Docker, replace the default temp folder with Laravel’s filesystem (e.g., `storage/app/mangopay`). Use `MANGOPAY_SANDBOX=true` in `.env` to toggle between sandbox and live environments.
Can I use this SDK with Laravel’s queue system for async operations?
No, the SDK lacks native Laravel queue support. Wrap SDK calls in Laravel jobs (e.g., `VerifyBankAccountJob`) and dispatch them via `dispatch()`. Use `retryAfter` middleware for resilience. For webhooks, create a `HandleIncomingWebhook` job to process Mangopay events asynchronously.
How do I validate Mangopay webhook HMAC signatures in Laravel?
Create a middleware (e.g., `ValidateMangopaySignature`) that checks the `X-Ma-HMAC-Signature` header against Mangopay’s secret key. Use Laravel’s `app('http')` to access the request payload. Add the middleware to your webhook route (e.g., `Route::post('/mangopay/webhook', ...)->middleware(ValidateMangopaySignature::class)`).
What’s the best way to manage idempotency for payments in Laravel?
The SDK lacks built-in idempotency. Create a Laravel middleware (e.g., `MangoPayIdempotency`) to generate and store unique keys (e.g., UUIDs) in Redis or the database. Attach the key to payment requests via the SDK’s `headers` parameter and validate responses to prevent duplicate processing.
Will this SDK work with Laravel 10+ and PHP 8.1+?
Yes, but with caveats. The SDK supports PHP 5.6+, but PHP 8.1+ features (e.g., named arguments) aren’t used. No breaking changes exist, but consider wrapping SDK calls in Laravel’s `app()` helper for type safety. Test thoroughly, as the SDK lacks PHP 8.1+ optimizations like return type declarations.
How do I configure mTLS for PCI compliance in Laravel?
Set the SDK’s `ClientCertificate` and `ClientPrivateKey` in `config/mangopay.php` using Base64 strings or file paths. Store certificates securely in Laravel’s encrypted storage (e.g., `storage/encrypted/mangopay`). Use environment variables (e.g., `MANGOPAY_CERT_PATH`) to avoid hardcoding paths.
Are there alternatives to this SDK for Laravel?
For Mangopay, this is the official PHP SDK. Alternatives include building a custom Guzzle-based wrapper or using a generic HTTP client like `spatie/laravel-guzzle-promise`. However, the official SDK provides Mangopay-specific abstractions (e.g., `Users`, `BankAccounts`) that simplify integration with Laravel’s Eloquent or API resources.
How do I test Mangopay interactions in Laravel’s testing environment?
Use Mangopay’s sandbox environment by setting `MANGOPAY_SANDBOX=true` in `.env.testing`. Mock the SDK’s `MangoPayApi` instance in PHPUnit tests with Laravel’s `Mockery` or `createMock()`. Verify responses by asserting against Mangopay’s sandbox API docs (e.g., test users/wallets).
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
bugban/symfony
beyonder-capi/workflow-extensions-bundle
beyonder-capi/job-queue-bundle
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin