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(2mo ago)10MITPHPPHP ^8.2

Since Mar 6Pushed 2mo 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 1mo 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

37

—

LowBetter than 83% of packages

Maintenance86

Actively maintained with recent releases

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

69d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7ed7912541ac3d0d53d33b3c33c7fcf42f7178c48a779da33984cbd49d6ee18a?d=identicon)[sumaia161](/maintainers/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

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[koenhendriks/laravel-str-acronym

A package to be able to generate acronyms from strings in Laravel projects using the Str helper and supports the Stringable class.

4352.9k](/packages/koenhendriks-laravel-str-acronym)[interaction-design-foundation/laravel-geoip

Support for multiple Geographical Location services.

17221.0k3](/packages/interaction-design-foundation-laravel-geoip)[nedwors/navigator

A Laravel package to ease defining navigation menus

433.1k](/packages/nedwors-navigator)[xefi/faker-php-laravel

Faker php integration with laravel

1915.1k](/packages/xefi-faker-php-laravel)[dcblogdev/laravel-junie

Install pre-configured guides for Jetbrains Junie

392.5k](/packages/dcblogdev-laravel-junie)

PHPackages © 2026

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