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

ActiveLibrary

mulertech/file-manipulation
===========================

This package manipulates and organizes files and path

v1.0.3(1y ago)03012MITPHPPHP ^8.3CI failing

Since Sep 29Pushed 1mo ago1 watchersCompare

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

READMEChangelog (4)Dependencies (6)Versions (6)Used By (2)

FileManipulation
================

[](#filemanipulation)

---

[![Latest Version on Packagist](https://camo.githubusercontent.com/691fb6a1bf94739ffd9e8758656d56f4b7c52414cbeede80d0f82132198a65de/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6d756c6572746563682f66696c652d6d616e6970756c6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mulertech/file-manipulation)[![GitHub Tests Action Status](https://camo.githubusercontent.com/36ea4825d53f87e27ffa29ed1863edb4b49facff0ef909620c54fcd2ccc4708e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f66696c652d6d616e6970756c6174696f6e2f74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/mulertech/file-manipulation/actions/workflows/tests.yml)[![GitHub PHPStan Action Status](https://camo.githubusercontent.com/fd883472fc6db0ce8fa7926d219791c8021888f687256ef8dd3a62f5fffa66e0/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f66696c652d6d616e6970756c6174696f6e2f7068707374616e2e796d6c3f6272616e63683d6d61696e266c6162656c3d7068707374616e267374796c653d666c61742d737175617265)](https://github.com/mulertech/file-manipulation/actions/workflows/phpstan.yml)[![GitHub Security Action Status](https://camo.githubusercontent.com/53383b8a70fa365c436b10e29eb78ba0541e90d4d05fd0a9688829e68a714bc5/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f6d756c6572746563682f66696c652d6d616e6970756c6174696f6e2f73656375726974792e796d6c3f6272616e63683d6d61696e266c6162656c3d7365637572697479267374796c653d666c61742d737175617265)](https://github.com/mulertech/file-manipulation/actions/workflows/security.yml)[![Total Downloads](https://camo.githubusercontent.com/4e3be79a09c320b0b81bca029bb69ffad616e46eb9c9b6c328f16153b890be1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d756c6572746563682f66696c652d6d616e6970756c6174696f6e2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/mulertech/file-manipulation)[![Test Coverage](https://raw.githubusercontent.com/mulertech/file-manipulation/badge/badge-coverage.svg)](https://packagist.org/packages/mulertech/file-manipulation)

---

This package manipulates files and paths

---

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

[](#installation)

###### *Two methods to install FileManipulation package with composer :*

[](#two-methods-to-install-filemanipulation-package-with-composer-)

1.

Add to your "**composer.json**" file into require section :

```
"mulertech/file-manipulation": "^1.0"

```

and run the command :

```
php composer.phar update

```

2.

Run the command :

```
php composer.phar require mulertech/file-manipulation "^1.0"

```

---

Usage
-----

[](#usage)

###### *Open env file : (return content of file)*

[](#open-env-file--return-content-of-file)

```
$envFile = new Env('path/to/envFile');
$content = $envFile->open();

```

// `key1=value1`

###### *Parse env file : (return parsed content of file)*

[](#parse-env-file--return-parsed-content-of-file)

```
$envFile = new Env('path/to/envFile');
$content = $envFile->parseFile();

```

// `['key' => 'value', 'key2' => 'value2']`

###### *Load env file : (load env file in environment variables)*

[](#load-env-file--load-env-file-in-environment-variables)

```
$envFile = new Env('path/to/envFile');
$content = $envFile->parseFile();

```

###### *Open json file : (return content of file)*

[](#open-json-file--return-content-of-file)

```
$jsonFile = new Json('path/to/file.json');
$content = $jsonFile->open();

```

// `['key' => 'value', 'key2' => 'value2']`

###### *Open php file : (return content of file)*

[](#open-php-file--return-content-of-file)

```
$phpFile = new Php('path/to/file.php');
$content = $phpFile->open();

```

// `['key' => 'value', 'key2' => 'value2']`

###### *Open yaml file : (return content of file)*

[](#open-yaml-file--return-content-of-file)

```
$yamlFile = new Yaml('path/to/file.yaml'); // or .yml
$content = $yamlFile->open();

```

// `['key' => 'value', 'key2' => 'value2']`

###### *Open other file : (return content of file)*

[](#open-other-file--return-content-of-file)

```
$otherFile = new FileManipulation('path/to/file.other');
$content = $otherFile->open();

```

// `['key' => 'value', 'key2' => 'value2']`

###### *Save env/json/php/yaml file :*

[](#save-envjsonphpyaml-file-)

```
$envFile = new Env('path/to/envFile');
$content = $envFile->saveFile('content to save');

```

###### *Save other file :*

[](#save-other-file-)

```
$otherFile = new FileManipulation('path/to/file.other');
$content = $otherFile->saveFile('content to save');

```

###### *Php file class name :*

[](#php-file-class-name-)

```
$phpFile = new Php('path/to/file.php');
$className = $phpFile->getClassName();

```

// `ClassName`

###### *Php get class names :*

[](#php-get-class-names-)

```
$phpFile = new Php('path/to/file.php');
$classNames = $phpFile->getClassNames();

```

// `['ClassName', 'ClassName2']`

###### *Php get class attribute named "Attribute::class" :*

[](#php-get-class-attribute-named-attributeclass-)

```
$phpFile = new Php('path/to/file.php');
$attribute = Php::getClassAttributeNamed(Class::class, Attribute::class);

```

// return ReflectionAttribute of `Attribute::class`

###### *Php get instance of class attribute named "Attribute::class" :*

[](#php-get-instance-of-class-attribute-named-attributeclass-)

```
$phpFile = new Php('path/to/file.php');
$attribute = Php::getInstanceOfClassAttributeNamed(Class::class, Attribute::class);

```

// return instance of `Attribute::class`

###### *Php get properties attributes :*

[](#php-get-properties-attributes-)

```
$phpFile = new Php('path/to/file.php');
$propertiesAttributes = Php::getPropertiesAttributes(Class::class);

```

// return array of ReflectionProperty of properties

###### *Php get instance of properties attributes named "Attribute::class" :*

[](#php-get-instance-of-properties-attributes-named-attributeclass-)

```
$phpFile = new Php('path/to/file.php');
$propertiesAttributes = Php::getInstanceOfPropertiesAttributesNamed(Class::class, Attribute::class);

```

// return array of property name =&gt; instances of `Attribute::class`

###### *Php get methods attributes :*

[](#php-get-methods-attributes-)

```
$phpFile = new Php('path/to/file.php');
$methodsAttributes = Php::getMethodsAttributes(Class::class);

```

// return array of ReflectionMethod of methods

###### *Php get instance of methods attributes named "Attribute::class" :*

[](#php-get-instance-of-methods-attributes-named-attributeclass-)

```
$phpFile = new Php('path/to/file.php');
$methodsAttributes = Php::getInstanceOfMethodsAttributesNamed(Class::class, Attribute::class);

```

// return array of method name =&gt; instances of `Attribute::class`

###### *Get first occurrence of a string in a file :*

[](#get-first-occurrence-of-a-string-in-a-file-)

```
$file = new FileManipulation('path/to/file'); // if for example php file : new Php('path/to/file.php')
$firstOccurrence = $file->getFirstOccurrence('string');

```

// return line of first occurrence (int)

###### *Get last occurrence of a string in a file :*

[](#get-last-occurrence-of-a-string-in-a-file-)

```
$file = new FileManipulation('path/to/file'); // if for example php file : new Php('path/to/file.php')
$lastOccurrence = $file->getLastOccurrence('string');

```

// return line of last occurrence (int)

###### *Get line number :*

[](#get-line-number-)

```
$file = new FileManipulation('path/to/file'); // if for example php file : new Php('path/to/file.php')
$lineNumber = $file->getLine(number);

```

// return content of line (string)

###### *Convert file :*

[](#convert-file-)

```
$jsonFile = new Json('path/to/file.json');
$yamlFile = new Yaml('path/to/file.yaml');
$jsonFile->convertFile($yamlFile);

```

// convert json file to yaml file

###### *Count lines :*

[](#count-lines-)

```
$file = new FileManipulation('path/to/file'); // if for example php file : new Php('path/to/file.php')
$lines = $file->countLines();

```

// return number of lines of file (int)

###### *Insert content at line number :*

[](#insert-content-at-line-number-)

```
$file = new FileManipulation('path/to/file'); // if for example php file : new Php('path/to/file.php')
$file->insertContentAtLineNumber('content', 2);

```

// insert content (one or more lines) at line number 2 and move other lines after

###### *Date path :*

[](#date-path-)

```
$dateStorage = new DateStorage('path');
$datePath = $dateStorage->datePath();

```

// return path of path/year/month (example : path/2022/02)

###### *Date filename :*

[](#date-filename-)

```
DateStorage::dateFilename('suffix');

```

// return filename with date (example : 20220201-suffix)

###### *Date time filename :*

[](#date-time-filename-)

```
DateStorage::dateTimeFilename('suffix');

```

// return filename with date and time (example : 20220201-1200-suffix)

###  Health Score

42

—

FairBetter than 90% of packages

Maintenance72

Regular maintenance activity

Popularity16

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity58

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 72% 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 ~63 days

Total

4

Last Release

404d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/357d309912bbc5318d9877d1369987d2390c8e034b637e9f20671c28b09b5119?d=identicon)[mulertech](/maintainers/mulertech)

---

Top Contributors

[![mulertech](https://avatars.githubusercontent.com/u/57788787?v=4)](https://github.com/mulertech "mulertech (18 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (7 commits)")

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[getkirby/cms

The Kirby core

1.5k535.5k352](/packages/getkirby-cms)[shopware/core

Shopware platform is the core for all Shopware ecommerce products.

595.2M386](/packages/shopware-core)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)

PHPackages © 2026

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