{"id":16329217,"url":"https://github.com/andrewgjohnson/linebreaks4imagettftext","last_synced_at":"2026-05-10T04:29:54.630Z","repository":{"id":56948025,"uuid":"135859938","full_name":"andrewgjohnson/linebreaks4imagettftext","owner":"andrewgjohnson","description":"linebreaks4imagettftext is a function to automatically insert line breaks into your text while using PHP's imagettftext function.","archived":false,"fork":false,"pushed_at":"2024-08-18T19:02:25.000Z","size":2544,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-27T10:39:13.349Z","etag":null,"topics":["composer","gd","graphics","image","images","php"],"latest_commit_sha":null,"homepage":"https://linebreaks4imagettftext.agjgd.org","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/andrewgjohnson.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":".github/SUPPORT.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"andrewgjohnson","patreon":"agjgd"}},"created_at":"2018-06-02T23:46:37.000Z","updated_at":"2024-08-18T19:02:28.000Z","dependencies_parsed_at":"2024-08-18T20:22:35.057Z","dependency_job_id":"2febc0f5-6612-429a-9d2b-e1715d86f25d","html_url":"https://github.com/andrewgjohnson/linebreaks4imagettftext","commit_stats":{"total_commits":21,"total_committers":2,"mean_commits":10.5,"dds":0.04761904761904767,"last_synced_commit":"0f623458c5796dda9c0f8abe729131ddf21981b1"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgjohnson%2Flinebreaks4imagettftext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgjohnson%2Flinebreaks4imagettftext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgjohnson%2Flinebreaks4imagettftext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrewgjohnson%2Flinebreaks4imagettftext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrewgjohnson","download_url":"https://codeload.github.com/andrewgjohnson/linebreaks4imagettftext/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243717960,"owners_count":20336461,"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":["composer","gd","graphics","image","images","php"],"created_at":"2024-10-10T23:14:49.745Z","updated_at":"2026-05-10T04:29:54.625Z","avatar_url":"https://github.com/andrewgjohnson.png","language":"PHP","funding_links":["https://github.com/sponsors/andrewgjohnson","https://patreon.com/agjgd","https://patreon.com/agjopensource"],"categories":[],"sub_categories":[],"readme":"# linebreaks4imagettftext\r\n\r\n[![MIT License](https://img.shields.io/badge/license-MIT-0366d6.png?colorB=0366d6\u0026style=flat-square)](https://github.com/andrewgjohnson/linebreaks4imagettftext/blob/master/LICENSE)\r\n[![Current Release](https://img.shields.io/github/release/andrewgjohnson/linebreaks4imagettftext.png?colorB=0366d6\u0026style=flat-square\u0026logoColor=white\u0026logo=github)](https://github.com/andrewgjohnson/linebreaks4imagettftext/releases)\r\n[![Contributors](https://img.shields.io/github/contributors/andrewgjohnson/linebreaks4imagettftext.png?colorB=0366d6\u0026style=flat-square\u0026logoColor=white\u0026logo=github)](https://github.com/andrewgjohnson/linebreaks4imagettftext/graphs/contributors)\r\n[![Packagist Downloads](https://img.shields.io/packagist/dt/andrewgjohnson/linebreaks4imagettftext.png?colorB=0366d6\u0026style=flat-square\u0026logoColor=white\u0026logo=packagist)](https://packagist.org/packages/andrewgjohnson/linebreaks4imagettftext/stats)\r\n[![Issues](https://img.shields.io/github/issues/andrewgjohnson/linebreaks4imagettftext.png?colorB=0366d6\u0026style=flat-square\u0026logoColor=white\u0026logo=github)](https://github.com/andrewgjohnson/linebreaks4imagettftext/issues)\r\n[![Patreon](https://linebreaks4imagettftext.agjgd.org/documentation/linebreaks4imagettftext.agjgd.org/images/patreon-badge.png)](https://patreon.com/agjopensource)\r\n\r\n\u003cp align=\"center\"\u003e\u003ca href=\"https://linebreaks4imagettftext.agjgd.org/\" title=\"\"\u003e\u003cimg src=\"https://linebreaks4imagettftext.agjgd.org/documentation/linebreaks4imagettftext.agjgd.org/images/avatar.png\" alt=\"\" title=\"\" width=\"400\" id=\"avatar\" /\u003e\u003c/a\u003e\u003c/p\u003e\r\n\r\n## Description\r\n\r\n**linebreaks4imagettftext** is a function to automatically insert line breaks into your text while using PHP’s imagettftext() function.\r\n\r\n[![Patreon - Become a Patron](https://raster.shields.io/badge/Patreon%20-become%20a%20Patron-FD334A.png?style=for-the-badge\u0026logo=patreon\u0026logoColor=FD334A)](https://patreon.com/agjopensource)\r\n\r\n**linebreaks4imagettftext** is an [agjgd](https://agjgd.org) project.\r\n\r\n## Usage\r\n\r\n### With Composer\r\n\r\nThis project offers support for the [Composer](https://getcomposer.org/) dependency manager. You can find the linebreaks4imagettftext package online on [packagist.org](https://packagist.org/packages/andrewgjohnson/linebreaks4imagettftext).\r\n\r\n#### Install using Composer\r\n\r\nEither run this command:\r\n\r\n    composer require andrewgjohnson/linebreaks4imagettftext\r\n\r\nor add this to the `require` section of your composer.json file:\r\n\r\n    \"andrewgjohnson/linebreaks4imagettftext\": \"1.*\"\r\n\r\n### Without Composer\r\n\r\nTo use without Composer add an [include](http://php.net/manual/function.include.php) to the [`linebreaks4imagettftext.php` source file](https://raw.githubusercontent.com/andrewgjohnson/linebreaks4imagettftext/master/source/linebreaks4imagettftext.php).\r\n\r\n    include_once 'source/linebreaks4imagettftext.php';\r\n\r\n## Example\r\n\r\n    // You can use linebreaks4imagettftext() to add line breaks (\"\\n\") to long strings to help format text when using imagettftext()\r\n    $string = 'This is a long sentence that could not fit on a single line.';\r\n    $stringWithLineBreaks = \\AndrewGJohnson\\AgjGd\\linebreaks4imagettftext(20, 0, $font, $string, imagesx($im) * 0.8);\r\n\r\n    // This will work but there will are no line breaks so your text will likely overflow horizontally\r\n    imagettftext($im, 20, 0, imagesx($im) * 0.1, 0, $color, $font, $string);\r\n\r\n    // This will work and you will not have to worry about text overflowing regardless of string length\r\n    imagettftext($im, 20, 0, imagesx($im) * 0.1, 0, $color, $font, $stringWithLineBreaks);\r\n\r\nThere are [other examples](https://github.com/andrewgjohnson/linebreaks4imagettftext/tree/master/examples) included in the GitHub repository and on [linebreaks4imagettftext.agjgd.org](https://linebreaks4imagettftext.agjgd.org/examples/).\r\n\r\n## Help Requests\r\n\r\nPlease post any questions in the [discussions area](https://github.com/andrewgjohnson/linebreaks4imagettftext/discussions) on GitHub if you need help.\r\n\r\nIf you discover a bug please [enter an issue](https://github.com/andrewgjohnson/linebreaks4imagettftext/issues/new) on GitHub. When submitting an issue please use our [issue template](https://github.com/andrewgjohnson/linebreaks4imagettftext/tree/master/.github/ISSUE_TEMPLATE).\r\n\r\n## Contributing\r\n\r\nPlease read our [contributing guidelines](https://github.com/andrewgjohnson/linebreaks4imagettftext/blob/master/.github/CONTRIBUTING.md) if you want to contribute.\r\n\r\nYou can contribute financially by becoming a [patron](https://patreon.com/agjopensource) at [patreon.com/agjopensource](https://patreon.com/agjopensource) to support linebreaks4imagettftext and [other agjgd.org projects](https://agjgd.org/projects/).\r\n\r\n[![Patreon - Become a Patron](https://raster.shields.io/badge/Patreon%20-become%20a%20Patron-FD334A.png?style=for-the-badge\u0026logo=patreon\u0026logoColor=FD334A)](https://patreon.com/agjopensource)\r\n\r\n## Acknowledgements\r\n\r\nThis project was started by [Andrew G. Johnson (@andrewgjohnson)](https://github.com/andrewgjohnson).\r\n\r\nFull list of contributors:\r\n * [Andrew G. Johnson (@andrewgjohnson)](https://github.com/andrewgjohnson)\r\n\r\nOur [security policies and procedures](https://github.com/andrewgjohnson/linebreaks4imagettftext/blob/master/.github/SECURITY.md) comes via the [atomist/samples](https://github.com/atomist/samples/blob/master/.github/SECURITY.md) project. Our [issue templates](https://github.com/andrewgjohnson/linebreaks4imagettftext/tree/master/.github/ISSUE_TEMPLATE) comes via the [tensorflow/tensorflow](https://github.com/tensorflow/tensorflow/blob/master/SECURITY.md) project. Our [pull request template](https://github.com/andrewgjohnson/linebreaks4imagettftext/blob/master/.github/PULL_REQUEST_TEMPLATE.md) comes via the [stevemao/github-issue-templates](https://github.com/stevemao/github-issue-templates) project. The [mountains photo](https://unsplash.com/photos/qJvpykJ5SKs) comes via [Gabriel Garcia Marengo](https://unsplash.com/@gabrielgm).\r\n\r\n## Changelog\r\n\r\nYou can find all notable changes in the [changelog](https://github.com/andrewgjohnson/linebreaks4imagettftext/blob/master/CHANGELOG.md).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewgjohnson%2Flinebreaks4imagettftext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrewgjohnson%2Flinebreaks4imagettftext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrewgjohnson%2Flinebreaks4imagettftext/lists"}