PHPackages                             hasan-22/open - 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. [File &amp; Storage](/categories/file-storage)
4. /
5. hasan-22/open

ActiveLibrary[File &amp; Storage](/categories/file-storage)

hasan-22/open
=============

It reads the whole file and you can perform a series of operations on it

v1.0.0(3y ago)010MITPHPPHP &gt;=7.4

Since Jan 24Pushed 3y ago1 watchersCompare

[ Source](https://github.com/HASSAN-22/open)[ Packagist](https://packagist.org/packages/hasan-22/open)[ Docs](https://github.com/HASSAN-22/open)[ RSS](/packages/hasan-22-open/feed)WikiDiscussions main Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

### It reads the whole file and you can perform a series of operations on it

[](#it-reads-the-whole-file-and-you-can-perform-a-series-of-operations-on-it)

#### It is very easy to use

[](#it-is-very-easy-to-use)

Install

```
 composer require hasan-22/open

```

### Functions

[](#functions)

FunctionReturnDescriptionExamplereadyObject of class OpenChecks that the class it creates has not already been createdopenObject of class OpenOpen file as arrayopen('filePath.txt')writeObject of class OpenWrites the changes to the filereadLinesarrayReturns an array of file linesgetStringstringIt converts the lines of the file that has been converted into an array into a string and returns itgetLinestringReturns a particular line from the filegetLine(2)firstLinestringget the first line of the filelastLinestringget the last line of the filebetweenarrayTaking lines between two linesbetween(3,10)appendObject of class OpenAdds the new word to the end of the fileappend('word1','word2',....)appendToObject of class OpenAdds the new word after the selected line of the fileappendTo('new word',3)prependObject of class OpenAdds the new word to the beginning of the fileprepend('word1','word2',....)prependToObject of class OpenAdds the new word to the beginning of the selected line of the fileprependTo('new word',4)cleanObject of class OpenRemove null or empty linedeleteLineObject of class OpenDelete a specific linedeleteLine(2)emptyFileObject of class OpenIt empties the filefileSizestringReturns the size of the file### For example, we want to add some text to our 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
]

```

###  Health Score

21

—

LowBetter than 18% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 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

1255d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/63023595?v=4)[Hasan Bahrami](/maintainers/HASSAN-22)[@HASSAN-22](https://github.com/HASSAN-22)

---

Top Contributors

[![HASSAN-22](https://avatars.githubusercontent.com/u/63023595?v=4)](https://github.com/HASSAN-22 "HASSAN-22 (4 commits)")

---

Tags

phpfileopenhasanread filewrite file

### Embed Badge

![Health badge](/badges/hasan-22-open/health.svg)

```
[![Health](https://phpackages.com/badges/hasan-22-open/health.svg)](https://phpackages.com/packages/hasan-22-open)
```

###  Alternatives

[blueimp/jquery-file-upload

File Upload widget for jQuery.

141.5M20](/packages/blueimp-jquery-file-upload)[davaxi/vcalendar

PHP Class to generate VCalendar (ics) file

1184.1k](/packages/davaxi-vcalendar)

PHPackages © 2026

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