PHPackages                             sumaiazaman/laravel-acronym-pluralizer - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. sumaiazaman/laravel-acronym-pluralizer

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

sumaiazaman/laravel-acronym-pluralizer
======================================

Fix Laravel pluralizer for uppercase acronyms (CD → CDs, not CDS)

v1.0.0(3mo ago)10MITPHPPHP ^8.2

Since Mar 6Pushed 3mo agoCompare

[ Source](https://github.com/sumaiazaman/laravel-acronym-pluralizer)[ Packagist](https://packagist.org/packages/sumaiazaman/laravel-acronym-pluralizer)[ RSS](/packages/sumaiazaman-laravel-acronym-pluralizer/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (2)Used By (0)

Laravel Acronym Pluralizer
==========================

[](#laravel-acronym-pluralizer)

Fix Laravel's pluralizer for uppercase acronyms like CD, DVD, URL, API.

**Before:** `Str::plural('CD')` returns `"CDS"`**After:** `Str::plural('CD')` returns `"CDs"`

The Problem
-----------

[](#the-problem)

Laravel's `Str::plural()` uses Doctrine's inflector which correctly returns `"CDs"` from `"CD"`. However, Laravel's `matchCase()` method then sees the input was all uppercase and runs `mb_strtoupper()` on the entire result, turning `"CDs"` into `"CDS"`.

This package fixes `matchCase()` so that when the inflector preserves the original uppercase stem and only appends a lowercase suffix, the suffix remains lowercase.

Words that actually change form (like CHILD → CHILDREN, PERSON → PEOPLE) still get fully uppercased as before.

Installation
------------

[](#installation)

```
composer require sumaiazaman/laravel-acronym-pluralizer
```

Then add the following to your project's `composer.json` to swap out the original Pluralizer class:

```
{
    "autoload": {
        "exclude-from-classmap": [
            "vendor/laravel/framework/src/Illuminate/Support/Pluralizer.php"
        ]
    }
}
```

Finally, rebuild the autoloader:

```
composer dump-autoload
```

That's it. No service providers, no config files. `Str::plural('CD')` will now return `"CDs"` everywhere in your application.

How It Works
------------

[](#how-it-works)

This package provides a drop-in replacement for `Illuminate\Support\Pluralizer` with a single fix in the `matchCase()` method. By using Composer's `exclude-from-classmap`, the original class is excluded from autoloading and this package's version is loaded instead.

The fix is minimal — when the input is all uppercase and the inflector preserved the original word exactly (just appended a suffix), we keep the original uppercase portion and leave the appended suffix as-is:

```
if ($function === 'mb_strtoupper' && str_starts_with($value, $comparison)) {
    return $comparison.mb_substr($value, mb_strlen($comparison));
}
```

Examples
--------

[](#examples)

InputBeforeAfter`Str::plural('CD')``CDS``CDs``Str::plural('DVD')``DVDS``DVDs``Str::plural('URL')``URLS``URLs``Str::plural('API')``APIS``APIs``Str::plural('CAR')``CARS``CARs``Str::plural('CHILD')``CHILDREN``CHILDREN`Testing
-------

[](#testing)

```
composer test
```

Related
-------

[](#related)

- [laravel/framework#56932](https://github.com/laravel/framework/issues/56932) — Original issue
- [laravel/framework#59094](https://github.com/laravel/framework/pull/59094) — Original PR

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE) for more information.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance78

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

114d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/80034544?v=4)[sumaia161](/maintainers/sumaia161)[@Sumaia161](https://github.com/Sumaia161)

---

Top Contributors

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

---

Tags

laravelinflectorstracronympluralizer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sumaiazaman-laravel-acronym-pluralizer/health.svg)

```
[![Health](https://phpackages.com/badges/sumaiazaman-laravel-acronym-pluralizer/health.svg)](https://phpackages.com/packages/sumaiazaman-laravel-acronym-pluralizer)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[renatomarinho/laravel-page-speed

Laravel Page Speed

2.5k1.7M11](/packages/renatomarinho-laravel-page-speed)[vinkius-labs/laravel-page-speed

Laravel Page Speed

2.5k9.6k1](/packages/vinkius-labs-laravel-page-speed)[emargareten/inertia-modal

Inertia Modal is a Laravel package that lets you implement backend-driven modal dialogs for Inertia apps.

90128.1k](/packages/emargareten-inertia-modal)[linkxtr/laravel-qrcode

A clean, modern, and easy-to-use QR code generator for Laravel

3614.9k](/packages/linkxtr-laravel-qrcode)[wearepixel/laravel-cart

A cart implementation for Laravel

1355.6k](/packages/wearepixel-laravel-cart)

PHPackages © 2026

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