承接 amitjoc/breakify 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

amitjoc/breakify

Composer 安装命令:

composer require amitjoc/breakify

包简介

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

README 文档

README

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

PHP Version License Build Status Code Style Issues Stars

Table of Contents

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

  • 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

  • Web Example and 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 character too for cli (in progress)

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: <hr />
  $web->phrDashed();  // OUTPUT: ------- 
  $web->phrDotted();  // OUTPUT: .......
  $web->phrRidge();   // OUTPUT: _______
  $web->phrDouble();  // OUTPUT: =======

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

Default

  • CLI: Default LineBreak is set to PHP_EOL
  • WEB: Default LineBreak is <br />

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

  • 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

  • PSR 4 or PSR12

CHANGES

  • namespace updated to LineBreak\\
  • made breakify class final

amitjoc/breakify 适用场景与选型建议

amitjoc/breakify 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 7 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 10 月 30 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 amitjoc/breakify 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 amitjoc/breakify 我们能提供哪些服务?
定制开发 / 二次开发

基于 amitjoc/breakify 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 7
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 27
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-30