Download the PHP package amitjoc/breakify without Composer
On this page you can find all versions of the php package amitjoc/breakify. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download amitjoc/breakify
More information about amitjoc/breakify
Files in amitjoc/breakify
Package breakify
Short Description Handle new line or line break across different platform (windows, unix, mac) and envirnoment like web, cli
License MIT
Informations about the package 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
Amit Joshi
Backend Developer | PHP & JavaScript Specialist
GitHub: @amitjoc
LinkedIn: @amitjoc
Table of Contents
- Author
- Installation
- Environment
- Feature List
- Examples
- CLI Usage
- Task List
- Coding Standards
Installation
Download the Breakify library
Include composer
autoloadfileCreate a Breakify object
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
- CLI Example
beap()(bell sound for CLI)- Normalize or convert line breaks across different platforms
(Windows \r\n, Unix \n, Mac \r) - Handle other
escape charactertoo for cli (in progress)
Example for WEB
When we already know that our script only executed on WEB environment
- print
br tag
Example for CLI
When we already know that our script only executed on cli environment
- 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]
functionswithpprefix directly give output likepbr(),phr(),pLineBreak()
Task List
Default
- [x]
CLI: DefaultLineBreakis set toPHP_EOL - [x]
WEB: DefaultLineBreakis<br />
Functions
- [x]
isCliEnv()function will check is execution environment. returntruefor cli elsefalse - [x]
exeEnvType()TypeWEB | CLI. it will return the output accordingly
Functions for web
- [x] print break tag
pbr() - [x] print horizontal tag
phr() - [x] print
dashed lineuse functionphrDashed() - [x] print
dotted lineuse functionphrDotted() - [x] print
ridge lineuse functionphrRidge() - [x] print
double lineuse functionphrDouble() - [ ] custom hr line width and height and center also with in build stylesheet
Coding Standard
- [x] PSR 4 or PSR12