coduo/php-humanizer
Humanize and format values for people: turn field names into readable labels, truncate plain text or HTML safely to word boundaries, and handle common string transformations. Lightweight PHP utility with simple static APIs.
user_id) into human-readable labels (e.g., "User ID") to reduce cognitive load for non-technical users.post_title → "Post Title").{"size": "5 MB"} instead of {"size": 5242880}).Adopt if:
snake_case to "Title Case" (user_id → "User ID").1048576 → "1 MB").Look elsewhere if:
ActiveSupport::Humanize)."This package lets us present technical data in a user-friendly way—like turning order_id_12345 into 'Order #12345'—without building custom logic. It’s a drop-in solution that improves UX for global users (supports 30+ languages) and reduces dev time for tasks like formatting file sizes or truncating text. For example, instead of exposing raw bytes in APIs, we’d show '5 MB,' which aligns with user expectations and cuts support questions. The MIT license and 1.7K+ GitHub stars mean it’s reliable and widely adopted."
*"Pros:
Humanizer::humanize($field)).Quick Wins:
created_at → 'Created At').{"size": "1.2 GB"}).Trade-offs:
Example Integration:
// In a Laravel service provider:
app()->singleton('humanizer', function () {
return new \Coduo\PHPHumanizer\StringHumanizer();
});
// Usage:
$humanizer = app('humanizer');
echo $humanizer->humanize('user_email'); // "User Email"
echo NumberHumanizer::binarySuffix(1024); // "1 kB"
```*
**Ask**: *"Should we prioritize this for [specific feature] or explore alternatives?"*
How can I help you explore Laravel packages today?