{"id":15769752,"url":"https://github.com/mrcgrtz/php-shorten","last_synced_at":"2025-04-15T17:45:41.665Z","repository":{"id":6223555,"uuid":"7454987","full_name":"mrcgrtz/php-shorten","owner":"mrcgrtz","description":"💬 Provides additional truncation functions in PHP.","archived":false,"fork":false,"pushed_at":"2025-04-02T04:38:51.000Z","size":310,"stargazers_count":11,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T22:32:18.204Z","etag":null,"topics":["html","markup","php","shorten","truncation","wordsafe-truncation"],"latest_commit_sha":null,"homepage":"https://packagist.org/packages/marcgoertz/shorten","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mrcgrtz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":"mrcgrtz","tidelift":null,"community_bridge":null,"liberapay":"mrcgrtz","issuehunt":null,"otechie":null,"custom":null}},"created_at":"2013-01-05T12:06:01.000Z","updated_at":"2025-04-02T04:38:53.000Z","dependencies_parsed_at":"2023-02-19T03:31:11.218Z","dependency_job_id":"c9bd8d79-0332-4713-859f-db917172085a","html_url":"https://github.com/mrcgrtz/php-shorten","commit_stats":{"total_commits":139,"total_committers":5,"mean_commits":27.8,"dds":0.5323741007194245,"last_synced_commit":"12c7faf897713a403326720fd1a7d19a76855e39"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcgrtz%2Fphp-shorten","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcgrtz%2Fphp-shorten/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcgrtz%2Fphp-shorten/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mrcgrtz%2Fphp-shorten/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mrcgrtz","download_url":"https://codeload.github.com/mrcgrtz/php-shorten/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249123602,"owners_count":21216523,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","markup","php","shorten","truncation","wordsafe-truncation"],"created_at":"2024-10-04T14:05:36.326Z","updated_at":"2025-04-15T17:45:41.649Z","avatar_url":"https://github.com/mrcgrtz.png","language":"PHP","funding_links":["https://ko-fi.com/mrcgrtz","https://liberapay.com/mrcgrtz"],"categories":[],"sub_categories":[],"readme":"# Shorten\n\n\u003e Provides additional truncation functions in PHP.\n\n[![Test](https://github.com/mrcgrtz/php-shorten/actions/workflows/test.yml/badge.svg)](https://github.com/mrcgrtz/php-shorten/actions/workflows/test.yml)\n[![Coverage Status](https://coveralls.io/repos/github/mrcgrtz/php-shorten/badge.svg?branch=main)](https://coveralls.io/github/mrcgrtz/php-shorten?branch=main)\n![Packagist PHP Version Support](https://img.shields.io/packagist/php-v/marcgoertz/shorten)\n![Packagist Downloads](https://img.shields.io/packagist/dt/marcgoertz/shorten)\n![Packagist Stars](https://img.shields.io/packagist/stars/marcgoertz/shorten)\n[![MIT License](https://img.shields.io/github/license/mrcgrtz/php-shorten)](https://github.com/mrcgrtz/php-shorten/blob/main/LICENSE.md)\n\n## Installation\n\nI recommend using [Composer](https://getcomposer.org/) for installing and using Shorten:\n\n```bash\ncomposer require marcgoertz/shorten\n```\n\nOf course you can also just require it in your scripts directly.\n\n## Usage\n\n```php\n\u003c?php\n\nuse Marcgoertz\\Shorten\\Shorten;\n\n$shorten = new Shorten();\nprint $shorten-\u003etruncateMarkup('\u003ca href=\"https://example.com/\"\u003eGo to example site\u003c/a\u003e', 10);\n?\u003e\n```\n\nOutput:\n\n```html\n\u003ca href=\"https://example.com/\"\u003eGo to exam\u003c/a\u003e…\n```\n\n## Functions\n\n```php\ntruncateMarkup(\n    string $markup,\n    int $length = 400,\n    string $appendix = '…',\n    bool $appendixInside = false,\n    bool $wordsafe = false\n): string\n```\n\n* String `$markup`: Text containing markup\n* Integer `$length`: Maximum length of truncated text (default: `400`)\n* String `$appendix`: Text added after truncated text (default: `'…'`)\n* Boolean `$appendixInside`: Add appendix to last content in tags, increases `$length` by 1 (default: `false`)\n* Boolean `$wordsafe`: Wordsafe truncation (default: `false`)\n* String `$delimiter`: Delimiter for wordsafe truncation (default: `' '`)\n\n## License\n\nMIT © [Marc Görtz](https://marcgoertz.de/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcgrtz%2Fphp-shorten","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmrcgrtz%2Fphp-shorten","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmrcgrtz%2Fphp-shorten/lists"}