Download the PHP package omar-haris/card-name-fit without Composer
On this page you can find all versions of the php package omar-haris/card-name-fit. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download omar-haris/card-name-fit
More information about omar-haris/card-name-fit
Files in omar-haris/card-name-fit
Package card-name-fit
Short Description PHP library to squeeze Arabic or English personal names to a fixed length for ID, bank or payment cards.
License MIT
Homepage https://github.com/omar-haris/card-name-fit
Informations about the package card-name-fit
Card Name Fit
A simple PHP library that solves the headache of fitting names on cards and badges. If you've ever struggled with names that are too long for credit cards, ID badges, or passport printing, this is your solution.
Why This Library?
We've all seen ID cards with awkwardly truncated names or ridiculously small fonts trying to fit long names. This library fixes that problem with intelligent name formatting for fixed-width spaces.
It's especially useful for:
- Card printing (credit, debit, ID, membership)
- Name badges and tags
- Passports and government IDs
- Any system with character limits for names
Key Features
- Smart formatting that preserves readability
- Handles both English and Arabic names with different strategies
- Adjustable character limits to match your exact requirements
- UTF-8 support for international names
- No external dependencies besides PHP's mbstring
Installation
Just run:
Basic Usage
Formatting Strategies
For English Names
The library offers two approaches:
1. GREEDY (default)
Keeps full middle names when possible, drops them when needed. People generally prefer seeing their complete names rather than initials.
2. DENSE
Ensures every name part appears, at least as an initial. Better when all name components must be represented.
For Arabic Names
Arabic names use a simple left-to-right approach, preserving whole words since initials don't make sense in Arabic.
Edge Cases Handled
Very Long Names
The library handles unusually long names gracefully:
Whitespace Cleanup
No need to worry about extra spaces or inconsistent formatting:
Configuration
Security & Compliance
This library only formats text - it doesn't store or transmit any personal data. It's designed with:
- GDPR considerations (no data retention)
- PCI DSS compatibility (no cardholder data storage)
Requirements
- PHP 8.3+
- mbstring extension
License
MIT License. See the LICENSE file.
Credits
All versions of card-name-fit with dependencies
ext-mbstring Version *