PHPackages                             jakson-fischer/returns - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. jakson-fischer/returns

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

jakson-fischer/returns
======================

Classe para padronizar retornos em sistemas

v1.0.2(1y ago)014MITPHPPHP &gt;=7.4

Since Sep 30Pushed 1y ago1 watchersCompare

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

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

Returns
=======

[](#returns)

Português (pt-BR)
-----------------

[](#português-pt-br)

### Descrição

[](#descrição)

Módulo criado para padronização de retornos de sistemas e APIs. O módulo pode ser utilizado para padronização dos retornos, quando necessário.

### Instalação

[](#instalação)

Para instalar o módulo via Composer, execute o seguinte comando:

```
composer require jakson-fischer/returns

```

### Parâmetros

[](#parâmetros)

- `$status`: **bool**, obrigatório
- `$message`: **string**, obrigatório
- `$errorCode`: não obrigatório (Campo aberto para uso interno, a documentação ficará na responsabilidade do usuário)
- `$errorType`: não obrigatório
- `$httpStatus`: não obrigatório

### Funções

[](#funções)

- **toArray**: Retorno dos dados enviados no formato de array.
- **toJson**: Retorno dos dados enviados no formato JSON.
- **arrayDataReturn**: Retorna os dados enviados encapsulados em um array dentro da chave `data`.
- **jsonDataReturn**: Retorna os dados enviados encapsulados em JSON dentro da chave `data`.

### Exemplos de uso

[](#exemplos-de-uso)

#### Chamada da classe

[](#chamada-da-classe)

```
use JaksonFischer\Returns\Returns;

echo Returns::toJson(true, "Test success message", NULL, NULL, 200);
```

#### toArray

[](#toarray)

**Entrada:**

```
return Returns::toArray(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);
```

**Saída:**

```
[
    "status" => false,
    "msg" => "Cliente não está autenticado no sistema!",
    "errorCode" => "#EA1527",
    "errorType" => "Erro de sistema",
    "httpStatus" => 511
]
```

#### toJson

[](#tojson)

**Entrada:**

```
return Returns::toJson(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);
```

**Saída:**

```
{
    "status": false,
    "msg": "Cliente não está autenticado no sistema!",
    "errorCode": "#EA1527",
    "errorType": "Erro de sistema",
    "httpStatus": 511
}
```

#### arrayDataReturn

[](#arraydatareturn)

**Entrada:**

```
Returns::arrayDataReturn(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);
```

**Saída:**

```
[
    "data" => [
        "status" => false,
        "msg" => "Cliente não está autenticado no sistema!",
        "errorCode" => "#EA1527",
        "errorType" => "Erro de sistema",
        "httpStatus" => 511
    ]
]
```

#### jsonDataReturn

[](#jsondatareturn)

**Entrada:**

```
Returns::jsonDataReturn(false, "Cliente não está autenticado no sistema!", "#EA1527", "Erro de sistema", 511);
```

**Saída:**

```
{
    "data": {
        "status": false,
        "msg": "Cliente não está autenticado no sistema!",
        "errorCode": "#EA1527",
        "errorType": "Erro de sistema",
        "httpStatus": 511
    }
}
```

---

Returns
-------

[](#returns-1)

### English

[](#english)

### Description

[](#description)

This module was created to standardize the returns for systems and APIs. It can be used for return standardization whenever necessary.

### Installation

[](#installation)

To install the module via Composer, run the following command:

```
composer require jakson-fischer/returns

```

### Parameters

[](#parameters)

- `$status`: **bool**, required
- `$message`: **string**, required
- `$errorCode`: optional (Open field for internal use, documentation responsibility lies with the user)
- `$errorType`: optional
- `$httpStatus`: optional

### Functions

[](#functions)

- **toArray**: Returns the sent data as an array.
- **toJson**: Returns the sent data as JSON.
- **arrayDataReturn**: Returns the sent data encapsulated in an array under the `data` key.
- **jsonDataReturn**: Returns the sent data encapsulated in JSON under the `data` key.

### Usage examples

[](#usage-examples)

#### Call class

[](#call-class)

```
use JaksonFischer\Returns\Returns;

echo Returns::toJson(true, "Test success message", NULL, NULL, 200);
```

#### toArray

[](#toarray-1)

**Input:**

```
return Returns::toArray(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);
```

**Output:**

```
[
    "status" => false,
    "msg" => "Client is not authenticated in the system!",
    "errorCode" => "#EA1527",
    "errorType" => "System error",
    "httpStatus" => 511
]
```

#### toJson

[](#tojson-1)

**Input:**

```
return Returns::toJson(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);
```

**Output:**

```
{
    "status": false,
    "msg": "Client is not authenticated in the system!",
    "errorCode": "#EA1527",
    "errorType": "System error",
    "httpStatus": 511
}
```

#### arrayDataReturn

[](#arraydatareturn-1)

**Input:**

```
Returns::arrayDataReturn(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);
```

**Output:**

```
[
    "data" => [
        "status" => false,
        "msg" => "Client is not authenticated in the system!",
        "errorCode" => "#EA1527",
        "errorType" => "System error",
        "httpStatus" => 511
    ]
]
```

#### jsonDataReturn

[](#jsondatareturn-1)

**Input:**

```
Returns::jsonDataReturn(false, "Client is not authenticated in the system!", "#EA1527", "System error", 511);
```

**Output:**

```
{
    "data": {
        "status": false,
        "msg": "Client is not authenticated in the system!",
        "errorCode": "#EA1527",
        "errorType": "System error",
        "httpStatus": 511
    }
}
```

###  Health Score

24

—

LowBetter than 32% of packages

Maintenance38

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

 Bus Factor1

Top contributor holds 95.5% 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

586d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/279877500b0cdaa35b31a8ed57861ede12f6340467900e68435b2522b5738f36?d=identicon)[jaksfischer](/maintainers/jaksfischer)

---

Top Contributors

[![jaksfischer](https://avatars.githubusercontent.com/u/29047674?v=4)](https://github.com/jaksfischer "jaksfischer (21 commits)")[![jaksonfischerh2](https://avatars.githubusercontent.com/u/164931854?v=4)](https://github.com/jaksonfischerh2 "jaksonfischerh2 (1 commits)")

---

Tags

returnsreturnsformaterpadronizar

### Embed Badge

![Health badge](/badges/jakson-fischer-returns/health.svg)

```
[![Health](https://phpackages.com/badges/jakson-fischer-returns/health.svg)](https://phpackages.com/packages/jakson-fischer-returns)
```

PHPackages © 2026

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