PHP Classes

Text Fit: Shorten text to fit within a limited length

Recommend this page to a friend!
  Info   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 47%Total: 425 All time: 6,359 This week: 673Up
Version License PHP version Categories
text-fit 1.1.3GNU General Publi...5.0PHP 5, Text processing
Description 

Author

This class can shorten text to fit within a limited length.

It can shorten a given text string by truncating text that exceeds a given length.

The class can also shorten file names by limiting them to a given length but preserving the original file name extension.

It may also fit text into columns of table cells by either shortening or wrapping the text in the column.

Innovation Award
PHP Programming Innovation award nominee
December 2012
Number 3


Prize: One downloadable copy of PhpED Professional
Sometimes it is necessary to limit the length of text to be displayed in certain circumstances. That is the case of text in e-mail messages or file names.

This class provides a solution to truncate text in a way that it does not cut words in the middle.

It can also shorten file names in a way that they do not exceed a certain limit, but still keep the file extension at the end of the file name.

Manuel Lemos
Picture of Tony
Name: Tony <contact>
Classes: 6 packages by
Country: Australia Australia
Age: ???
All time rank: 99016 in Australia Australia
Week rank: 195 Up1 in Australia Australia Up
Innovation award
Innovation award
Nominee: 2x

Screenshots (1)  
  • TextFit-examples.png
  Files folder image Files (5)  
File Role Description
Plain text file TextFit.class.php Class TextFit class
Accessible without login Plain text file examples.php Example Example script
Accessible without login Plain text file TextFit.doc.txt Doc. Usage information
Accessible without login Plain text file GPL.txt Lic. License information

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:425
This week:0
All time:6,359
This week:673Up
User Ratings User Comments (1)
 All time
Utility:50%StarStarStar
Consistency:75%StarStarStarStar
Documentation:75%StarStarStarStar
Examples:75%StarStarStarStar
Tests:-
Videos:-
Overall:47%StarStarStar
Rank:3086