PHPackages                             sentgine/file - 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. sentgine/file

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

sentgine/file
=============

A simple wrapper around file system operations.

v1.1.1(1y ago)0301MITPHPPHP ^8.1

Since Apr 12Pushed 1y ago1 watchersCompare

[ Source](https://github.com/sentgine/file)[ Packagist](https://packagist.org/packages/sentgine/file)[ RSS](/packages/sentgine-file/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)DependenciesVersions (5)Used By (1)

File by Sentgine
================

[](#file-by-sentgine)

[![License](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE.md)[![Latest Stable Version](https://camo.githubusercontent.com/136cac4b90efcecf93f85a5d979918fd1a6273b8edab38af5c90f188f32115a7/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73656e7467696e652f66696c652e737667)](https://packagist.org/sentgine/file)[![Total Downloads](https://camo.githubusercontent.com/ef0801f3f36314921eaf0acdce27dc214e65c724af47bb6515126f0abbf47335/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656e7467696e652f66696c652e737667)](https://packagist.org/packages/sentgine/file)

File is a PHP library that provides a simple wrapper around file system operations.

Features
--------

[](#features)

- Create, read, update, and delete files.
- Create directories if they do not exist.
- Replace placeholders in a source file and write the modified content to a destination file.
- Remove directories and all their contents recursively.

Requirements
------------

[](#requirements)

- PHP 8.0 or higher.

Installation
------------

[](#installation)

You can install the package via Composer by running the following command:

```
composer require sentgine/file:^1.0
```

Sample Usage of Filesystem
==========================

[](#sample-usage-of-filesystem)

### Basic Usage

[](#basic-usage)

```
use Sentgine\File\Filesystem;

// Create a new instance of the Filesystem class
$fileSystem = new Filesystem();

// Set source and destination files
$fileSystem->setSourceFile('path/to/source/file.txt')
           ->setDestinationFile('path/to/destination/file.txt');

// Read content from the source file
$content = $fileSystem->read();

// Update content in the destination file
$fileSystem->update('New content');

// Delete the destination file
$fileSystem->delete();
```

### Usage of replaceContent

[](#usage-of-replacecontent)

```
use Sentgine\File\Filesystem;

// Create a new instance of the Filesystem class
$fileSystem = new Filesystem();

 // Get the content of the file.text file
$content = $filesystem->setSourceFile('/source/directory/file.text')->read();

// Create a new directory if it doesn't exist
$filesystem->createDirectory('/source/new_directory');

// Write the content to the Controller file
$filesystem->setDestinationFile('/source/new_directory/new_file.text')->create($content);

// Replace the content of the destination file
$filesystem->replaceContent(
    replacements: [
       'placeholder1' => 'replacement1',
        'placeholder2' => 'replacement2',
    ]
);
```

The destination file (path/to/source/file.txt) should contain placeholders formatted as {{ placeholder }}, as shown in the example below:

```
Hello {{ placeholder1 }},

This is a sample file with placeholders. Here is the value of placeholder2: {{ placeholder2 }}.

Thank you!
```

Changelog
---------

[](#changelog)

Please see the [CHANGELOG](https://github.com/sentgine/file/blob/main/CHANGELOG.md) file for details on what has changed.

Security
--------

[](#security)

If you discover any security-related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

**File** is built and maintained by Adrian Navaja.

- Check out some cool tutorials and stuff on [YouTube](https://www.youtube.com/@sentgine)!
- Catch my latest tweets and updates on [Twitter](https://twitter.com/sentgine) (formerly X)!
- Let's connect on a more professional note over on [LinkedIn](https://www.linkedin.com/in/adrian-navaja/)!
- For more information about me and my work, visit my website: [sentgine.com](https://www.sentgine.com/).

License
-------

[](#license)

The MIT License (MIT). Please see the [LICENSE](https://github.com/sentgine/file/blob/main/LICENSE) file for more information.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance32

Infrequent updates — may be unmaintained

Popularity7

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

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

Every ~26 days

Total

4

Last Release

685d ago

Major Versions

v0.0.1 → v1.0.02024-04-16

### Community

Maintainers

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

---

Top Contributors

[![sentgine](https://avatars.githubusercontent.com/u/122154706?v=4)](https://github.com/sentgine "sentgine (9 commits)")

### Embed Badge

![Health badge](/badges/sentgine-file/health.svg)

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

###  Alternatives

[knplabs/gaufrette

PHP library that provides a filesystem abstraction layer

2.5k39.8M123](/packages/knplabs-gaufrette)[google/cloud-storage

Cloud Storage Client for PHP

34390.8M125](/packages/google-cloud-storage)[illuminate/filesystem

The Illuminate Filesystem package.

15261.6M2.6k](/packages/illuminate-filesystem)[superbalist/flysystem-google-storage

Flysystem adapter for Google Cloud Storage

26320.6M30](/packages/superbalist-flysystem-google-storage)[creocoder/yii2-flysystem

The flysystem extension for the Yii framework

2931.7M62](/packages/creocoder-yii2-flysystem)[flowjs/flow-php-server

PHP library for handling chunk uploads. Works with flow.js html5 file uploads.

2451.6M15](/packages/flowjs-flow-php-server)

PHPackages © 2026

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