Download the PHP package refatbd/bd-courier-fraud-checker without Composer

On this page you can find all versions of the php package refatbd/bd-courier-fraud-checker. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package bd-courier-fraud-checker

BD Courier Fraud Checker Typing SVG

Packagist Version Downloads PHP Laravel License

Maintained with ❤️ by refatbd


A Laravel package that checks a Bangladeshi phone number against the data of four major couriers — Steadfast, Pathao, RedX, and Carrybee — and tells you, in one call, how risky that customer is before you confirm a Cash-on-Delivery order.


📑 Table of Contents


✨ Features

Feature Description
🔁 One call, four couriers A single check() queries Steadfast, Pathao, RedX & Carrybee.
📊 Delivery success rate Delivered / cancelled / total + auto-calculated percentages.
🚨 Detailed complaints Steadfast returns the full complaint list — name, details, date & image.
🏷️ Fraud labels Pathao rating, RedX segment, Carrybee complaint count.
Smart caching Auth tokens/cookies cached for ~50 min — fewer logins, faster checks.
🛡️ Resilient In-call re-auth on expired sessions, request timeouts, browser-like headers, graceful failures, BD phone validation.
🧩 Extensible Drop in a new courier class and wire it up in minutes.

📦 Installation

Publish the config file:


⚙️ Configuration

Add your courier merchant credentials to your .env file:

💡 You only need to configure the couriers you actually use. A courier with missing credentials simply returns status => false instead of breaking the whole check.


🚀 Usage

That's it — $result is an array keyed by courier. Loop over it, render it, or feed it into your own risk score.


🧾 Response Format

⚠️ Always check status before reading data. When a courier fails (auth error, no data, etc.) it returns ['status' => false, 'message' => '...'] with no data key.

🟥 Pathao counts may be null. Pathao migrated to a rating-based model, so most merchant accounts receive no numeric delivery countsshowCount and countsAvailable are false, and the count fields are null (not 0, to avoid implying a customer with zero orders). The package still returns the full numeric breakdown for any account that is entitled to counts (countsAvailable: true). Guard on countsAvailable before doing math on Pathao counts. Steadfast, RedX, and Carrybee continue to return real numeric counts.


🚚 Supported Couriers

| Courier | Status | Delivery Stats | Fraud Signal | |:-------:|:------:|:--------------:|:-------------| | **Steadfast** | ✅ | ✅ | ✅ Full complaint list — `frauds[]` (name · details · date · image) | | **Pathao** | ✅ | ⚠️ Rating-based¹ | 🏷️ Rating + risk — `customerRating`, `riskLevel` | | **RedX** | ✅ | ✅ | 🏷️ Segment label — `customerSegment` | | **Carrybee** | ✅ | ✅ | 🔢 Complaint count — `fraudCount` | ¹ Pathao moved to a rating-based model — most accounts get no numeric counts (`countsAvailable: false`). Numeric counts are still returned for entitled accounts.

More couriers can be added easily — see Adding a New Courier.


🧠 How the Fraud Signal Works

Each courier exposes risk differently. The package normalizes the delivery stats for all of them, and surfaces each courier's native fraud signal on top:

Courier Field Example values Meaning
Steadfast frauds[] + fraudReportCount complaint objects Real merchant-submitted complaints with text, date & image
Pathao customerRating + riskLevel excellent_customerlow, fraud_customerhigh Pathao's internal rating, mapped to a coarse risk level
RedX customerSegment Normal Customer, High Return Customer RedX's internal customer tier
Carrybee fraudCount 0, 3, … How many complaints Carrybee holds for the number

🔎 Only Steadfast returns the full who / what / when complaint text. The others give a single label or count — useful as a quick red flag, but without the details.

Pathao customerRatingriskLevel mapping:

customerRating riskLevel
excellent_customer, good_customer low
regular_customer, new_customer medium
fraud_customer high
unknown / missing null

➕ Adding a New Courier

Click to expand the step-by-step guide
**1.** Create a new class in `src/Courier/YourCourier.php`: **2.** Add credentials to `config/bdcourierfraudchecker.php`: **3.** Inject it into `CourierCheckerService` and add it to the `check()` return array. **4.** Bind it in `BdCourierFraudCheckerServiceProvider`.

❓ FAQ

Do I need an account with every courier?
No. Configure only the couriers you use. Unconfigured couriers return status => false and are skipped — the rest still work.
Why are Pathao's delivery counts null?
Pathao migrated the customer-success endpoint to a rating-based model. Most merchant accounts now receive show_count: false with no numeric delivery counts at all — only a customer_rating. The package returns null for the count fields (and countsAvailable: false) rather than fake 0s, so you can tell "Pathao gave us no counts" apart from "a customer with zero orders". The customerRating / riskLevel is your reliable Pathao signal. If your account is entitled to numeric counts, the package returns them automatically with countsAvailable: true — no code change needed. This is a Pathao server-side policy and can't be toggled from the API.
Is the data cached?
Only the auth tokens / session cookies are cached (~50 minutes) to avoid logging in on every request. The fraud lookup itself runs fresh on every call, so results are always current.
What phone formats are accepted?
Any valid Bangladeshi mobile number — with or without the +88/88 prefix. The package normalizes and validates it (01[3-9]XXXXXXXX) for you.

📝 Changelog

See CHANGELOG.md for the full version history.

Latest — v1.2.0: connection hardening across all four couriers (browser-like headers, request timeouts, in-call re-authentication on stale sessions) and Pathao's rating-based response shape (riskLevel, showCount, countsAvailable; counts are null when Pathao doesn't expose them). ⚠️ Guard on countsAvailable before doing math on Pathao counts.


📄 License

Released under the MIT License — free to use, modify, and distribute.

footer ⭐ If this package saved you from a fraud order, consider starring the repo!

All versions of bd-courier-fraud-checker with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4|^8.0|^8.1|^8.2|^8.3
ext-openssl Version *
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package refatbd/bd-courier-fraud-checker contains the following files

Loading the files please wait ...