# php-shorten **Repository Path**: wfdaj/php-shorten ## Basic Information - **Project Name**: php-shorten - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-13 - **Last Updated**: 2023-11-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Shorten > Provides additional truncation functions in PHP. [![Test](https://github.com/mrcgrtz/php-shorten/actions/workflows/test.yml/badge.svg)](https://github.com/mrcgrtz/php-shorten/actions/workflows/test.yml) [![Coverage Status](https://coveralls.io/repos/github/mrcgrtz/php-shorten/badge.svg?branch=main)](https://coveralls.io/github/mrcgrtz/php-shorten?branch=main) ![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/marcgoertz/shorten) ![Packagist Downloads](https://img.shields.io/packagist/dt/marcgoertz/shorten) ![Packagist Stars](https://img.shields.io/packagist/stars/marcgoertz/shorten) [![MIT License](https://img.shields.io/github/license/mrcgrtz/php-shorten)](https://github.com/mrcgrtz/php-shorten/blob/main/LICENSE.md) ## Installation I recommend using [Composer](https://getcomposer.org/) for installing and using Shorten: ```bash composer require marcgoertz/shorten ``` Of course you can also just require it in your scripts directly. ## Usage ```php truncateMarkup('Go to example site', 10); ?> ``` Output: ```html Go to exam… ``` ## Functions ```php truncateMarkup( string $markup, int $length = 400, string $appendix = '…', bool $appendixInside = false, bool $wordsafe = false ): string ``` * String `$markup`: Text containing markup * Integer `$length`: Maximum length of truncated text (default: `400`) * String `$appendix`: Text added after truncated text (default: `'…'`) * Boolean `$appendixInside`: Add appendix to last content in tags, increases `$length` by 1 (default: `false`) * Boolean `$wordsafe`: Wordsafe truncation (default: `false`) * String `$delimiter`: Delimiter for wordsafe truncation (default: `' '`) ## License MIT © [Marc Görtz](https://marcgoertz.de/)