ravols/laravel-everifin
Composer 安装命令:
composer require ravols/laravel-everifin
包简介
This is my package laravel-everifin
README 文档
README
This package serves as a Laravel bridge, enabling the seamless creation and management of payments through the Everifin payment gateway. It is built upon the original PHP SDK from Everifin, ensuring robust functionality and compatibility. Check the PHP SDK here.
Installation
You can install the package via composer:
composer require ravols/laravel-everifin
You can publish the config file with:
php artisan vendor:publish --tag="laravel-everifin-config"
This is the contents of the published config file:
return [ 'client_id' => env('EVERIFIN_CLIENT_ID'), 'client_secret' => env('EVERIFIN_CLIENT_SECRET'), 'client_iban' => env('EVERIFIN_CLIENT_IBAN'), ];
You can use this config values when setting up your Config instance.
Usage
To begin, you need to create an instance of your Config class. This instance is designed as a singleton, meaning it's only instantiated once during the lifecycle of your application. The reason it's not globally defined in a provided service is to cater for situations where your project supports multiple e-commerce sites and requires dynamic configuration value changes.
In most cases, adhere to the following approach:
<?php use Ravols\EverifinPhp\Config; use Ravols\LaravelEverifin\Facades\LaravelEverifinOrders; class EverifinPaymentProcessor { public function __construct() { Config::getInstance()->setClientSecret(config('everifin.client_secret'))->setClientIban(config('everifin.client_iban'))->setClientId(config('everifin.client_id')); } public function createPaymentLink(Order $order): string { //Your logic for ecommerce orders $responseData = LaravelEverifinOrders::createPayment( amount: 120.99, currency: 'EUR', redirectUrl: 'https://my-domain/payment/' . $order->number, recipientIban: Config::getInstance()->getClientIban(), message: 'My message', email: $order->user->email, recipientName: 'My company name', variableSymbol: 'Variable symbol', //For non CZ and SK sites use reference field ); //$responseData contains much more than a link, feel free to check it out return $responseData->link; } }
Once the payment is paid for or cancelled on the payment gateway, customer is redirect back to the redirectUrl that you provided in the createPayment method. Now, you need to retrieve the payment status and handle your order as you wish.
You can retireve the payment ID as it's always send back to the redirect url as a get parameter ID or store it in a database during payment creation from the $responseData above.
use Ravols\LaravelEverifin\Facades\LaravelEverifinPayments; use Ravols\EverifinPhp\Exceptions\ResponseException; //Your logic in class //Get payment status try { $paymentStatus = LaravelEverifinPayments::getPayment(paymentId: request()->id); } catch (ResponseException $e) { $errors = collect($e->errors); //Here you can find errors from Everifin gateway in case request fails //Your logic for handling error cases } //Your logic with ifs, switch cases or any other way if($paymentStatus === 'BOOKED') { //Complete order logic } if($paymentStatus === 'FAILED') { //Handle error statuses. }
List of all statuses can be found on the documentation page.
List of error codes and their descriptions can be found on the documentation page.
Credits
License
The MIT License (MIT). Please see License File for more information.
ravols/laravel-everifin 适用场景与选型建议
ravols/laravel-everifin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 86 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 12 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「Ravols」 「laravel-everifin」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 ravols/laravel-everifin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 ravols/laravel-everifin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 ravols/laravel-everifin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is my package socialite-seznam-driver
Alfabank REST API integration
PHP sdk for Everifin payment gateway.
This is my package elastic-insight
LaraLogsToolkit is a package that allows you to analyze your logs and get the count of errors, info and warnings.
Laravel package for Accurate Online API integration.
统计信息
- 总下载量: 86
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 6
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-12-19