shahariar-ahmad / courier-fraud-checker-bd
A fraud detection tool for e-commerce platforms to analyze customer order behavior across Steadfast and Pathao couriers.
Requires
- php: ^8.1
- illuminate/http: ^11.0 || ^12.0 || ^13.0
README
A Laravel package to detect potential fraudulent orders by checking customer delivery behavior through Pathao and Steadfast courier services in Bangladesh.
✨ Features
- Check customer delivery history across multiple couriers
- Validate Bangladeshi phone numbers
- Get success/cancel/total delivery statistics
- Supports both Pathao and Steadfast courier services
⚙️ Installation
Install via Composer:
composer require shahariar-ahmad/courier-fraud-checker-bd
Add Service Provider (Laravel 5.4 and below)
In config/app.php
:
'providers' => [ ShahariarAhmad\CourierFraudCheckerBd\CourierFraudCheckerBdServiceProvider::class, ],
Add Facade Alias (optional)
In config/app.php
:
'aliases' => [ 'CourierFraudCheckerBd' => ShahariarAhmad\CourierFraudCheckerBd\Facade\CourierFraudCheckerBd::class, ],
🔧 Configuration
Add these environment variables to your .env
file:
# Pathao Credentials PATHAO_USER=your_pathao_email PATHAO_PASSWORD=your_pathao_password # Steadfast Credentials STEADFAST_USER=your_steadfast_email STEADFAST_PASSWORD=your_steadfast_password
🚀 Usage
Basic Usage
use CourierFraudCheckerBd; $result = CourierFraudCheckerBd::check('01886607475'); print_r($result);
Output:
[ 'pathao' => ['success' => 5, 'cancel' => 2, 'total' => 7], 'steadfast' => ['success' => 3, 'cancel' => 1, 'total' => 4] ]
☎️ Phone Number Validation
The package automatically validates phone numbers with this regex:
/^01[3-9][0-9]{8}$/
✅ Valid examples:
01712345678
01876543219
❌ Invalid examples:
+8801712345678
(includes country code)1234567890
(too short)02171234567
(invalid prefix)
🛠️ Advanced Usage
Using Individual Services
use ShahariarAhmad\CourierFraudCheckerBd\Services\PathaoService; use ShahariarAhmad\CourierFraudCheckerBd\Services\SteadfastService; $pathao = (new PathaoService())->pathao('01712345678'); $steadfast = (new SteadfastService())->steadfast('01712345678');
Custom Validation Rules
use ShahariarAhmad\CourierFraudCheckerBd\Helpers\CourierFraudCheckerHelper; CourierFraudCheckerHelper::validatePhoneNumber('01712345678');
🧹 Troubleshooting
Common Issues
-
Missing Environment Variables
- Ensure all required credentials are set in
.env
- Run
php artisan config:clear
after updating
- Ensure all required credentials are set in
-
Invalid Phone Number Format
- Must use local (BD) format like
01712345678
- Do not include
+88
prefix
- Must use local (BD) format like
📝 License
This package is open-source software licensed under the GNU General Public License v3.0 (GPL-3.0).
Under this license:
✅ You are allowed to:
- Use the package for personal or commercial projects.
- Modify the source code for your own use.
- Distribute the modified or original source code provided you also license it under GPL-3.0.
- Study and learn from the source code freely.
❌ You are NOT allowed to:
- Re-license the package under a different license.
- Distribute the package as part of a proprietary/commercial closed-source software without making your source code public.
- Sub-license or sell the software under a restrictive license.
Important:
If you distribute modified versions of this package, you must also release your changes under the GPL-3.0 license and include the original copyright.
GPL-3.0 promotes freedom to use, share, and modify, but ensures that any distributed version remains free and open-source.
💬 Support
For issues and feature requests:
- Email: muhd.shahariar@gmail.com