hasan-22/open
Composer 安装命令:
composer require hasan-22/open
包简介
It reads the whole file and you can perform a series of operations on it
README 文档
README
It reads the whole file and you can perform a series of operations on it
It is very easy to use
Install
composer require hasan-22/open
Functions
| Function | Return | Description | Example |
|---|---|---|---|
| ready | Object of class Open | Checks that the class it creates has not already been created | |
| open | Object of class Open | Open file as array | open('filePath.txt') |
| write | Object of class Open | Writes the changes to the file | |
| readLines | array | Returns an array of file lines | |
| getString | string | It converts the lines of the file that has been converted into an array into a string and returns it | |
| getLine | string | Returns a particular line from the file | getLine(2) |
| firstLine | string | get the first line of the file | |
| lastLine | string | get the last line of the file | |
| between | array | Taking lines between two lines | between(3,10) |
| append | Object of class Open | Adds the new word to the end of the file | append('word1','word2',....) |
| appendTo | Object of class Open | Adds the new word after the selected line of the file | appendTo('new word',3) |
| prepend | Object of class Open | Adds the new word to the beginning of the file | prepend('word1','word2',....) |
| prependTo | Object of class Open | Adds the new word to the beginning of the selected line of the file | prependTo('new word',4) |
| clean | Object of class Open | Remove null or empty line | |
| deleteLine | Object of class Open | Delete a specific line | deleteLine(2) |
| emptyFile | Object of class Open | It empties the file | |
| fileSize | string | Returns the size of the file |
For example, we want to add some text to our file
$file = \Open\Open::ready();
$result = $file->open('file.txt')
->append('word','word1')
->appendTo('word2',1)
->prepend('word3','word4')
->prependTo('word5',2)
->clean()
->write();
or
We want to add text to our file and then receive a array output
$result = $file->open('file.txt')
->append('word','word1')
->appendTo('word2',1)
->prepend('word3','word4')
->prependTo('word5',2)
->clean()
->write()->readLines();
print_r($result);
Sample output
[
[0] => word3
[1] => word4
[2] => word5
[3] => word
[4] => word1
[5] => word2
]
!!!! If you want to just get the output without writing to the file, omit the write() method. !!!!
For example
$result = $file->open('file.txt')
->append('word','word1')
->appendTo('word2',1)
->readLines();
print_r($result);
Sample output
[
[0] => word
[1] => word1
[2] => word2
]
hasan-22/open 适用场景与选型建议
hasan-22/open 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 10 次下载、GitHub Stars 达 0, 最近一次更新时间为 2023 年 01 月 24 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「file」 「open」 「hasan」 「read file」 「write file」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hasan-22/open 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hasan-22/open 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hasan-22/open 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Netgen Open Graph Bundle is an Ibexa Platform bundle that allows simple integration with Open Graph protocol.
The file manager intended for using Laravel with CKEditor / TinyMCE / Colorbox
A tool for scraping URL resources (oEmbed, OpenGraph, Twitter cards, JSON-LD)
Laravel Media Popup to upload/view the files
PMVC Plugin for File information
Mapper for accessing resources in KWCMS
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 17
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-01-24