brightcweb/paypal
Composer 安装命令:
composer require brightcweb/paypal
包简介
A professional PayPal integration package for Laravel applications, suitable for any Laravel application, such as NGO'S, e-commerces and more
关键字:
README 文档
README
Brightcweb/Paypal is a Laravel package that simplifies PayPal integration for your e-commerce system or donation platform. With this package, you can handle payments efficiently while maintaining the flexibility to customize routes, views, and authentication requirements.
Features
- Seamless PayPal checkout integration.
- Customizable success and cancellation routes.
- Records all payment transactions in the
Brightcwebpaymenttable. - Optionally enforce user authentication before checkout.
- Pre-built, modifiable views for success and cancellation pages.
Installation
Install the package via Composer:
composer require brightcweb/paypal
Publish the package configuration assets:
php artisan vendor:publish --tag=brightpaypalconfig
Run the migrations to create the Brightcwebpayment table:
php artisan migrate
Add the following entries to your .env file:
PAYPAL_CLIENT_ID=your-paypal-client-id PAYPAL_CLIENT_SECRET=your-paypal-client-secret
Clear and cache the configuration:
php artisan config:clear php artisan cache:clear php artisan config:cache
Usage
Controller Setup
- In your controller, import the PayPal class and inject it into the constructor:
use Brightcweb\Paypal\Myclass\BrightCWebPaypalClass; class YourController extends Controller { protected $BrightCwebPaypalClass; public function __construct(BrightCWebPaypalClass $BrightCWebPaypalClass) { $this->BrightCwebPaypalClass = $BrightCWebPaypalClass; } }
Checkout Endpoint
Create a route and controller method for initiating the checkout process. Example:
public function checkout(Request $req) { $amount = $req->amount; // Get order or donation amount $paymentData = $this->BrightCwebPaypalClass->createPaypalOrder($amount); return redirect($paymentData['links'][1]['href']); }
Define the route in web.php:
Route::get('/checkout', [YourController::class, 'checkout'])->name('checkout');
Success and Cancel Routes
Add routes for handling successful and canceled payments:
public function successpaypal(Request $request) { $orderId = $request->query('token'); $payerId = $request->query('PayerID'); $paymentDetails = $this->BrightCwebPaypalClass->handlePaymentSuccess($orderId, $payerId); if ($paymentDetails) { // Optionally send notifications or update tables return view('vendor.brightcwebpaypal.sucesspaypal', $paymentDetails); } return view('vendor.brightcwebpaypal.canceled'); } public function cancelpaypal() { return view('vendor.brightcwebpaypal.canceled'); }
Define these routes in web.php:
Route::get('/successpaypal', [YourController::class, 'successpaypal'])->name('successpaypal'); Route::get('/cancelpaypal', [YourController::class, 'cancelpaypal'])->name('cancelpaypal');
Add these routes in your .env file:
PAYPAL_SUCCESS_ROUTE="success payment route name" PAYPAL_CANCELLED_ROUTE="cancelled payment route name"
Views Customization
The package includes default views for success and cancellation located in vendor/brightcwebpaypal. Feel free to modify or rename them according to your needs.
Authentication
This package allows you to decide whether users should be authenticated before proceeding with checkout or not. You can customize your middleware as needed.
Key Features
Payment Recording
Every successful payment is recorded in the Brightcwebpayment table for easy tracking.
Optional Authentication
You have full control over whether users need to be authenticated before initiating a checkout or not. This package works perfectly without authentication, which is useful in scenarios where registration is not required for checkout.
Clearing and Caching Configuration
Whenever you make changes to your .env file or configuration, remember to run the following commands:
php artisan config:clear php artisan cache:clear php artisan config:cache
Notes
- Ensure that your PayPal credentials in the
.envfile are correct. - Ensure that
PAYPAL_SUCCESS_ROUTEandPAYPAL_CANCELLED_ROUTEare correctly set in your.envfile. - Always test your integration in PayPal's sandbox environment before going live.
- Use
php artisan optimize:clearif you encounter any cache-related issues.
Support
For support, please send us an email at: chikanwazuo@gmail.com
License
This package is open-sourced software licensed under the MIT license.
Contributing
We welcome contributions to enhance this package. Please contact us at chikanwazuo@gmail.com for any inquiries or contributions.
Conclusion
The Brightcweb PayPal Package is an excellent tool for integrating a payment gateway into your Laravel application, suitable for any project requiring PayPal payment integration.
brightcweb/paypal 适用场景与选型建议
brightcweb/paypal 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 4 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 01 月 26 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「paypal」 「payment processing」 「laravel」 「payment gateway」 「laravel paypal」 「laravel payment gateway」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 brightcweb/paypal 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 brightcweb/paypal 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 brightcweb/paypal 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PayPal SDK for ExpressCheckout and AdaptivePayments. Supports recurring payments, simple payments, parallel payments and chained payments.
paywant api php client
A PayPal IPN (Instant Payment Notification) listener for PHP
Librería para la gestión sencilla de pagos mediante TPV Redsys y Paypal
Convert and operate with FIPS codes for states, counties, etc.
Rich payment solutions for Laravel framework. Paypal, payex, authorize.net, be2bill, omnipay, recurring paymens, instant notifications and many more
统计信息
- 总下载量: 4
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 19
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-01-26