# TenantLicenseService — memory fix

    cp -R licfix/app/* ./app/

The first version indexed all ~400,000 prospects in PHP arrays and blew the 128 MB
memory limit. This version indexes the ~500 tenants instead and streams prospects past
them in 5,000-row chunks — the same direction ProspectMatchService already uses.

Two other improvements while rewriting:
- Name keys are sorted word-sets, so "Lou Nell Chambless" matches TDLR's
  "CHAMBLESS, LOU NELL" (the old version compared raw letter order and never would).
- When a tenant matches several licences, a phone match wins over a name match, and
  otherwise the later expiry wins — that's the licence currently governing them.

## Test
    php artisan test --filter=TenantLicense
