PHPackages                             amitjoc/breakify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. amitjoc/breakify

ActiveLibrary[CLI &amp; Console](/categories/cli)

amitjoc/breakify
================

Handle new line or line break across different platform (windows, unix, mac) and envirnoment like web, cli

v0.1.0(6mo ago)02[1 PRs](https://github.com/amitjoc/breakify/pulls)MITPHPPHP &gt;=7.4CI passing

Since Oct 30Pushed 2mo agoCompare

[ Source](https://github.com/amitjoc/breakify)[ Packagist](https://packagist.org/packages/amitjoc/breakify)[ RSS](/packages/amitjoc-breakify/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (3)Used By (0)

Breakify
========

[](#breakify)

Breakify is a lightweight PHP utility for managing and transforming line breaks across platforms and formats. Whether you're normalizing text input, preparing content for HTML output, or ensuring consistent formatting in logs or CLI tools, Breakify offers a clean, expressive API to handle it all.

Author
======

[](#author)

**Amit Joshi**
Backend Developer | PHP &amp; JavaScript Specialist
GitHub: [@amitjoc](https://github.com/amitjoc)
LinkedIn: [@amitjoc](https://www.linkedin.com/in/amitjoc/)

[![PHP Version](https://camo.githubusercontent.com/ce0c70c519047d0e507604f03e6e8ae6c27bcc072027e899680d9bf93804dc76/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342532422d626c7565)](https://camo.githubusercontent.com/ce0c70c519047d0e507604f03e6e8ae6c27bcc072027e899680d9bf93804dc76/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342532422d626c7565)[![License](https://camo.githubusercontent.com/4eed2ae27a380e671945205d5520763a89b0e81eeb893e66911d775a7e53e9f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616d69746a6f632f627265616b696679)](https://camo.githubusercontent.com/4eed2ae27a380e671945205d5520763a89b0e81eeb893e66911d775a7e53e9f0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f616d69746a6f632f627265616b696679)[![Build Status](https://camo.githubusercontent.com/400a629e261045b054a7860a015a8f382b473372655a2577f4ca911a0e1202a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616d69746a6f632f627265616b6966792f7068702e796d6c)](https://camo.githubusercontent.com/400a629e261045b054a7860a015a8f382b473372655a2577f4ca911a0e1202a5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f616d69746a6f632f627265616b6966792f7068702e796d6c)[![Code Style](https://camo.githubusercontent.com/5beafc293f0d1aba699b808c56e9889e59505c75185a86d4605202cc4e393a32/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d50535231322d677265656e)](https://camo.githubusercontent.com/5beafc293f0d1aba699b808c56e9889e59505c75185a86d4605202cc4e393a32/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f636f64652532307374796c652d50535231322d677265656e)[![Issues](https://camo.githubusercontent.com/50e9fdb3ebbd9d427b44fab46d8818afe15267f4c4c52d31f1713442cb9fa957/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f616d69746a6f632f627265616b696679)](https://camo.githubusercontent.com/50e9fdb3ebbd9d427b44fab46d8818afe15267f4c4c52d31f1713442cb9fa957/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f616d69746a6f632f627265616b696679)[![Stars](https://camo.githubusercontent.com/1e65f62019c072b6e0542680ac7fe390d63b219fa29b93b923e7c5804d5600aa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f616d69746a6f632f627265616b6966793f7374796c653d736f6369616c)](https://camo.githubusercontent.com/1e65f62019c072b6e0542680ac7fe390d63b219fa29b93b923e7c5804d5600aa/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f73746172732f616d69746a6f632f627265616b6966793f7374796c653d736f6369616c)

Table of Contents
=================

[](#table-of-contents)

- [Author](#author)
- [Installation](#installation)
- [Environment](#environment)
- [Feature List](#feature-list)
- [Examples](#example-for-web)
- [CLI Usage](#example-for-cli)
- [Task List](#task-list)
- [Coding Standards](#coding-standard)

Installation
============

[](#installation)

> Download the Breakify library

```
 composer require amitjoshi/breakify
```

> Include composer `autoload` file

```
 include_once dirname(__DIR__) . "/vendor/autoload.php";
```

> Create a Breakify object

```
  $web = new Breakify();
```

Environment
===========

[](#environment)

- `WEB`: Use when a script runs only in browser-based environments.
- `CLI`: Use when a script runs only in command-line environments.
- `BOTH`: Use when the environment is dynamic or unknown.

Feature List
============

[](#feature-list)

- [Web Example](#example-for-web) and [CLI Example](#example-for-cli)
- `beap()` (bell sound for CLI)
- Normalize or convert line breaks across different platforms `(Windows \r\n, Unix \n, Mac \r)`
- Handle other `escape character` too for cli (`in progress`)

Example for WEB
---------------

[](#example-for-web)

When we already know that our `script` only executed on `WEB` environment

- print `br tag`

```
  $web = new Breakify()
  $web->pbr();        // OUTPUT: Print's `break tag` directly
  $web->phr();        // OUTPUT:
  $web->phrDashed();  // OUTPUT: -------
  $web->phrDotted();  // OUTPUT: .......
  $web->phrRidge();   // OUTPUT: _______
  $web->phrDouble();  // OUTPUT: =======
```

Example for CLI
---------------

[](#example-for-cli)

When we already know that our `script` only executed on `cli` environment

```
$cliBreak = new Breakify();

$cliBreak->getLineBreak()   //  returns `PHP_EOL`
$cliBreak->pNewLine()       //  echoes single line break
$cliBreak->pNewLine(true)   //  echoes double line break
```

- print carriage return also `\r`
- print text withing the box with desired character like —, = (in progress)
- Make a bell sound `beap()` from php (available only in cli mode)

Important

1. `functions` with `p` prefix directly give output like `pbr()`,`phr()`,`pLineBreak()`

Task List
=========

[](#task-list)

Default
-------

[](#default)

- `CLI`: Default `LineBreak` is set to `PHP_EOL`
- `WEB`: Default `LineBreak` is ``

Functions
---------

[](#functions)

- `isCliEnv()` function will check is execution environment. return `true` for cli else `false`
- `exeEnvType()` Type `WEB | CLI`. it will return the output accordingly

Functions for `web`
-------------------

[](#functions-for-web)

- print break tag `pbr()`
- print horizontal tag `phr()`
- print `dashed line` use function `phrDashed()`
- print `dotted line` use function `phrDotted()`
- print `ridge line` use function `phrRidge()`
- print `double line` use function `phrDouble()`
- custom hr line width and height and center also with in build stylesheet

Coding Standard
---------------

[](#coding-standard)

- PSR 4 or PSR12

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance77

Regular maintenance activity

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

200d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e73ffe73e560a8ab833fb98e91a649b3b729aeecf0ea93dd4ccea8a42c5280b6?d=identicon)[amitjoc](/maintainers/amitjoc)

---

Top Contributors

[![amitjoc](https://avatars.githubusercontent.com/u/34548066?v=4)](https://github.com/amitjoc "amitjoc (38 commits)")

---

Tags

cmdcommand-linephp7php8powershellshell

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/amitjoc-breakify/health.svg)

```
[![Health](https://phpackages.com/badges/amitjoc-breakify/health.svg)](https://phpackages.com/packages/amitjoc-breakify)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
