PHPackages                             plugse/fileandpath - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. plugse/fileandpath

ActiveLibrary[Logging &amp; Monitoring](/categories/logging)

plugse/fileandpath
==================

A library to assist in writing and reading documents.

1.0.0(3y ago)2291MITPHPPHP &gt;=7.4

Since May 7Pushed 2y ago1 watchersCompare

[ Source](https://github.com/joselio105/FileAndPath)[ Packagist](https://packagist.org/packages/plugse/fileandpath)[ Docs](https://github.com/joselio105/FileAndPath)[ RSS](/packages/plugse-fileandpath/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (1)Versions (6)Used By (1)

[![Logo](https://private-user-images.githubusercontent.com/8493620/239583032-997b2841-f3bf-497d-aaea-736f8ad84b9c.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyOTM3MTgsIm5iZiI6MTc3NTI5MzQxOCwicGF0aCI6Ii84NDkzNjIwLzIzOTU4MzAzMi05OTdiMjg0MS1mM2JmLTQ5N2QtYWFlYS03MzZmOGFkODRiOWMuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDRUMDkwMzM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDM0NDczNjdlMTFiNzczNjA4OTkwMWIxMGY4ZDdlOTY3YjdhMmJhZGRiMGU2NGRkZWFkOGZhZjhjYTJiYjRhNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.e_keGcJ1xVJxTfMvhgUz5j7IBX9-mZa83ZTEAWnqSyk)](https://private-user-images.githubusercontent.com/8493620/239583032-997b2841-f3bf-497d-aaea-736f8ad84b9c.jpg?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NzUyOTM3MTgsIm5iZiI6MTc3NTI5MzQxOCwicGF0aCI6Ii84NDkzNjIwLzIzOTU4MzAzMi05OTdiMjg0MS1mM2JmLTQ5N2QtYWFlYS03MzZmOGFkODRiOWMuanBnP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI2MDQwNCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNjA0MDRUMDkwMzM4WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZDM0NDczNjdlMTFiNzczNjA4OTkwMWIxMGY4ZDdlOTY3YjdhMmJhZGRiMGU2NGRkZWFkOGZhZjhjYTJiYjRhNyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.e_keGcJ1xVJxTfMvhgUz5j7IBX9-mZa83ZTEAWnqSyk)

[![GitHub release (release name instead of tag name)](https://camo.githubusercontent.com/420188e6eb4e4e83e567fe3c6a6c8eca6d2a33802a32d3dc57b18621934d9fc4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6a6f73656c696f3130352f66696c65616e64706174683f696e636c7564655f70726572656c6561736573)](https://camo.githubusercontent.com/420188e6eb4e4e83e567fe3c6a6c8eca6d2a33802a32d3dc57b18621934d9fc4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f6a6f73656c696f3130352f66696c65616e64706174683f696e636c7564655f70726572656c6561736573)[![GitHub](https://camo.githubusercontent.com/99b0c6ac5a531dcfcbeb5d0c96a8f52ba080bb5f34c9d5c30d9866a4df8ba5af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a6f73656c696f3130352f46696c65416e6450617468)](https://camo.githubusercontent.com/99b0c6ac5a531dcfcbeb5d0c96a8f52ba080bb5f34c9d5c30d9866a4df8ba5af/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6a6f73656c696f3130352f46696c65416e6450617468)[![PHP](https://camo.githubusercontent.com/a520e5a5a42544a99f065e5da40037ceec1e76140f36e1e3849cd46ec8cddaa5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342e33332d626c7565)](https://camo.githubusercontent.com/a520e5a5a42544a99f065e5da40037ceec1e76140f36e1e3849cd46ec8cddaa5/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d372e342e33332d626c7565)[![PHP Unit](https://camo.githubusercontent.com/2cc7818b50c2070dc7cef67df30244734da87483aebe435119e00bf702e7e84f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e63656e636965732d504850556e6974392e362d79656c6c6f77677265656e)](https://camo.githubusercontent.com/2cc7818b50c2070dc7cef67df30244734da87483aebe435119e00bf702e7e84f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646570656e63656e636965732d504850556e6974392e362d79656c6c6f77677265656e)

Salvando e lendo dados em arquivos de maneira simplificada

Menu
----

[](#menu)

- [Instalação como Dependência](#instala%C3%A7%C3%A3o-como-depend%C3%AAncia)
    - [Diretamente pelo Composer](#diretamente-pelo-composer)
    - [Alterando o arquivo composer.json](#alterando-o-arquivo-composerjson)
- [Rodando os Testes](#rodando-os-testes)
- [Funcionalidades](#funcionalidades)
- [Exceções](#exce%C3%A7%C3%B5es)

Instalação como dependência
---------------------------

[](#instalação-como-dependência)

Instale File and Path usando o **Composer**

### Diretamente pelo Composer

[](#diretamente-pelo-composer)

```
  composer require plugse/fileandpath
```

### Alterando o arquivo composer.json

[](#alterando-o-arquivo-composerjson)

1. Crie ou altere o arquivo composer.json
2. Crie ou altere a propriedade **require**

```
{
    "require": {
        "plugse/fileandpath": "^1"
    }
}
```

3. Atualize a biblioteca com o comando abaixo:

```
    composer update
```

Rodando os testes
-----------------

[](#rodando-os-testes)

Para rodar os testes, rode o seguinte comando

```
  composer run-script post-install-cmd
```

Funcionalidades
---------------

[](#funcionalidades)

- **Cria um caminho caso ainda não exista**

```
File::createPathIfNotExists(
    string $path
): void
```

- **Salva um array em um arquivo JSON**

```
Json::Save(
    string $filename,
    array $dataStructure
): void
```

- **Salva um array em um arquivo .ENV**

```
Env::save(
    string $filename,
    array $dataStructure
): void
```

- **Salva um array em um arquivo de LOG**

```
Log::save(
    string $filename,
    array $dataStructure
): void
```

- **Lê um arquivo JSON e retorna o conteúdo como um array**

```
Json::read(
    string $filename
): array
```

- **Lê um arquivo .ENV e retorna o conteúdo como um array**

```
Env::read(
    string $filename
): array
```

- **Lê um arquivo de LOG e retorna o conteúdo como um array**

```
Log::read(
    string $filename
): array
```

Exceções
--------

[](#exceções)

- FileAlreadyExists
- FileNotFound

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity48

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

1095d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/01e8ecfafffaef0c0d42e3c44f950f9a5a1adc2445021ff95b9644a83fc8f3a8?d=identicon)[joselio105](/maintainers/joselio105)

---

Top Contributors

[![joselio105](https://avatars.githubusercontent.com/u/8493620?v=4)](https://github.com/joselio105 "joselio105 (49 commits)")

---

Tags

logjsonpathfileenvreadwrite

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/plugse-fileandpath/health.svg)

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

###  Alternatives

[putyourlightson/craft-log-to-file

Logs messages to a specific log file for Craft CMS.

29368.0k5](/packages/putyourlightson-craft-log-to-file)

PHPackages © 2026

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