PHPackages                             whilesmart/eloquent-leads - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. whilesmart/eloquent-leads

ActiveLibrary

whilesmart/eloquent-leads
=========================

Polymorphic lead register with a status lifecycle and DB-level dedupe for Laravel applications.

046PHP

Since Jul 12Pushed 1mo agoCompare

[ Source](https://github.com/whilesmartphp/eloquent-leads)[ Packagist](https://packagist.org/packages/whilesmart/eloquent-leads)[ RSS](/packages/whilesmart-eloquent-leads/feed)WikiDiscussions dev Synced 1w ago

READMEChangelogDependenciesVersions (1)Used By (0)

whilesmart/eloquent-leads
=========================

[](#whilesmarteloquent-leads)

A polymorphic lead register for Laravel: a discovered potential customer with a status lifecycle. A lead is not a customer and never auto-converts; converting one into a customer is the host app's concern. Each lead is scoped to an owner (a workspace, organization, user) through [`whilesmart/eloquent-owner-access`](https://github.com/whilesmartphp/eloquent-owner-access), can point at a polymorphic subject it is interested in (e.g. a product), and is deduplicated per owner at the database level.

Install
-------

[](#install)

```
composer require whilesmart/eloquent-leads
php artisan migrate

```

Routes register automatically under the `api` prefix with `auth:sanctum`. Set `LEADS_REGISTER_ROUTES=false` to mount them yourself.

Owning model
------------

[](#owning-model)

Add the trait to whatever owns leads:

```
use Whilesmart\Leads\Traits\HasLeads;

class Workspace extends Model
{
    use HasLeads;
}

$workspace->leads()->create([
    'name' => 'Jane Doe',
    'channel' => 'referral',
    'source' => 'Acme Inc',
    'source_url' => 'https://acme.example/contact/jane',
    'contact_email' => 'jane@acme.example',
    'why' => 'Asked about the enterprise plan',
]);
```

Deduplication
-------------

[](#deduplication)

A lead's `dedupe_hash` is a per-owner fingerprint of its strongest identity, in order: `source_url`, then `handle`, then `contact_email`, then `contact_phone`. Two leads for the same owner that share that identity produce the same hash, and a unique index on `dedupe_hash`lets the database reject the duplicate. A lead with no identifying value has a null hash and is never treated as a duplicate.

Endpoints
---------

[](#endpoints)

MethodPathPurposeGET`/api/leads`List (filter by `status`)POST`/api/leads`CreateGET`/api/leads/{lead}`ShowPUT/PATCH`/api/leads/{lead}`UpdateDELETE`/api/leads/{lead}`Soft deletePATCH`/api/leads/{lead}/status`Move through the lifecycleStatus
------

[](#status)

`LeadStatus`: `new`, `qualified`, `contacted`, `won`, `lost`, `dismissed`. `status` is stored as a string and validated against the enum on write.

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance59

Moderate activity, may be stable

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1ca6f6e01ecbfe6640ff410c4f0321054fb48d05a5f843c2b89887b90369bcd?d=identicon)[whilesmart](/maintainers/whilesmart)

---

Top Contributors

[![nfebe](https://avatars.githubusercontent.com/u/14317775?v=4)](https://github.com/nfebe "nfebe (1 commits)")

### Embed Badge

![Health badge](/badges/whilesmart-eloquent-leads/health.svg)

```
[![Health](https://phpackages.com/badges/whilesmart-eloquent-leads/health.svg)](https://phpackages.com/packages/whilesmart-eloquent-leads)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
