PHPackages                             hdaklue/polish - 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. hdaklue/polish

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

hdaklue/polish
==============

A Laravel package for data polishing and transformation

1.0.4(7mo ago)06MITPHPPHP ^8.1

Since Sep 24Pushed 7mo agoCompare

[ Source](https://github.com/hdaklue/polish)[ Packagist](https://packagist.org/packages/hdaklue/polish)[ RSS](/packages/hdaklue-polish/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (5)Dependencies (6)Versions (6)Used By (0)

Polish
======

[](#polish)

**The Laravel package that transforms enterprise-level formatting chaos into elegant, centralized mastery**

The Pain Every Laravel Developer Recognizes
-------------------------------------------

[](#the-pain-every-laravel-developer-recognizes)

Your product manager walks in with "small formatting changes" that trigger a nightmare across your entire application. Customer tier badges, order statuses, financial displays — what seems like simple updates becomes hunting down scattered logic across:

- Filament admin dashboards with buried conditional styles
- API endpoints with inconsistent formatting rules
- Email templates, PDF reports, and webhook payloads
- Background jobs running different calculations

**The real problem:** Your sophisticated business formatting has no architectural home, so it spreads into an unmaintainable mess of duplicate code across every layer of your production application.

Your enterprise-grade Laravel application deserves enterprise-grade formatting architecture.

Table of Contents
-----------------

[](#table-of-contents)

- [The Solution](#the-solution)
- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Built-in Polishers](#built-in-polishers)
- [Use Cases](#use-cases)
- [Framework Integration](#framework-integration)
- [Creating Custom Polishers](#creating-custom-polishers)
- [Advanced Features](#advanced-features)
- [Why Polish?](#why-polish)
- [Requirements](#requirements)
- [License](#license)

The Solution: Give Your Formatting Logic a Proper Home
------------------------------------------------------

[](#the-solution-give-your-formatting-logic-a-proper-home)

Polish provides a beautifully simple, static-first approach that Laravel developers actually *want* to use. Define your formatting rules once in clean "Polisher" classes, then use them everywhere without dependency injection, configuration files, or architectural complexity.

```
// Before: Scattered, inconsistent, unmaintainable chaos
substr($ulid, -6)           // In Filament column
substr($ulid, -6)           // In Livewire computed property
substr($ulid, -6)           // In Blade template
substr($ulid, -6)           // In API resource
substr($ulid, -6)           // In notification
substr($ulid, -6)           // In DTO transformation
// ... and 15 other places you'll inevitably forget about

// After: Centralized, consistent, maintainable elegance
UlidPolisher::short($ulid)  // Everywhere, every time, perfectly consistent
```

**The magic moment**: Change from 6 to 7 characters in your polisher class, and instantly watch every Filament column, Livewire component, Blade template, API response, notification, and DTO across your entire application reflect the change. One update, universal consistency, zero hunting.

Installation: Up and Running in 30 Seconds
------------------------------------------

[](#installation-up-and-running-in-30-seconds)

Add Polish to your project with a single command:

```
composer require hdaklue/polish
```

That's literally it. Polish auto-registers with Laravel using package discovery, requires zero configuration, and you're immediately ready to create your first polisher. No config files to publish, no service providers to register, no setup complexity — just install and start polishing.

Basic Usage
-----------

[](#basic-usage)

### Create Your First Polisher in 30 Seconds

[](#create-your-first-polisher-in-30-seconds)

Polish includes a delightful Artisan command that generates polisher boilerplate faster than you can think:

```
php artisan polisher:make Document
# ✅ Creates: App\Polishers\DocumentPolisher

php artisan polisher:make User/Profile
# ✅ Creates: App\Polishers\User\ProfilePolisher

php artisan polisher:make Payment/Card
# ✅ Creates: App\Polishers\Payment\CardPolisher
```

The command follows Laravel conventions perfectly — namespaced classes, PSR-4 autoloading, and clean directory structure. Everything you expect, nothing you don't.

### Create Polishers Your Way

[](#create-polishers-your-way)

Or skip the command and extend `BasePolisher` directly for full control:

```
