PHPackages                             aivopro/integrity - 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. [Security](/categories/security)
4. /
5. aivopro/integrity

ActiveLibrary[Security](/categories/security)

aivopro/integrity
=================

AiVoPro System Integrity Manager - Verificação de saúde e configuração da API com suporte a JWT

00PHP

Since Jan 20Pushed 5mo agoCompare

[ Source](https://github.com/OARANHA/aivopro-integrity)[ Packagist](https://packagist.org/packages/aivopro/integrity)[ RSS](/packages/aivopro-integrity/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

28Fácil Integrity Manager
=========================

[](#28fácil-integrity-manager)

[![PHP Version](https://camo.githubusercontent.com/7663c9d53dc13cedaf0660a8745a7e77d2dd711257f36aa86ebce12a0600ef42/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7068702d253345253344382e312d626c75652e737667)](https://php.net/)[![License](https://camo.githubusercontent.com/8bb50fd2278f18fc326bf71f6e88ca8f884f72f179d3e555e20ed30157190d0d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e2e737667)](LICENSE)

**Sistema de Verificação de Integridade para o Ecossistema 28Fácil**

Pacote PHP para monitoramento e validação da saúde da API [api.28facil.com.br](https://api.28facil.com.br), incluindo health checks, validação de credenciais e verificação de dependências essenciais.

---

📦 Instalação
------------

[](#-instalação)

Instale via Composer:

```
composer require 28facil/integrity
```

---

🚀 Uso Básico
------------

[](#-uso-básico)

### Health Check Simples

[](#health-check-simples)

```
use AiVoPro\Integrity\IntegrityManager;

$manager = new IntegrityManager('https://api.28facil.com.br');

// Verificação rápida
if ($manager->isHealthy()) {
    echo "API está saudável!";
} else {
    echo "API com problemas: " . $manager->getLastError();
}
```

### Auditoria Completa

[](#auditoria-completa)

```
use AiVoPro\Integrity\IntegrityManager;

$manager = new IntegrityManager(
    apiUrl: 'https://api.28facil.com.br',
    apiKey: 'sua-api-key-aqui'
);

// Executa todas as checagens
$report = $manager->audit();

echo "Status Geral: " . $report->getStatus() . "\n";
echo "Versão da API: " . $report->getVersion() . "\n";
echo "Tempo de Resposta: " . $report->getResponseTime() . "ms\n";

// Verificar checagens individuais
foreach ($report->getChecks() as $check) {
    echo sprintf(
        "[%s] %s: %s\n",
        $check->isPassed() ? '✓' : '✗',
        $check->getName(),
        $check->getMessage()
    );
}
```

### Checagens Específicas

[](#checagens-específicas)

```
// Verificar apenas a versão
$version = $manager->checkVersion();
echo "Versão atual: {$version->version}\n";

// Validar credenciais
$auth = $manager->checkAuthentication('sua-api-key');
if ($auth->isValid()) {
    echo "Credenciais válidas!\n";
}

// Verificar dependências
$deps = $manager->checkDependencies();
foreach ($deps->getServices() as $service => $status) {
    echo "{$service}: " . ($status ? 'OK' : 'FALHOU') . "\n";
}
```

---

🔍 Checagens Disponíveis
-----------------------

[](#-checagens-disponíveis)

ChecagemDescrição**Health Check**Verifica se a API está respondendo**Version Check**Obtém e valida a versão da API**Authentication**Valida API keys e tokens**Dependencies**Verifica serviços essenciais (DB, Redis, etc)**Performance**Mede tempo de resposta e latência**Endpoints**Testa endpoints críticos---

⚙️ Configuração Avançada
------------------------

[](#️-configuração-avançada)

### Com Cache

[](#com-cache)

```
use Symfony\Component\Cache\Adapter\FilesystemAdapter;

$cache = new FilesystemAdapter('28facil_integrity', 300);
$manager = new IntegrityManager(
    apiUrl: 'https://api.28facil.com.br',
    cache: $cache
);
```

### Timeout Customizado

[](#timeout-customizado)

```
$manager = new IntegrityManager(
    apiUrl: 'https://api.28facil.com.br',
    timeout: 10.0,  // segundos
    retries: 3
);
```

### Modo Silencioso (sem exceções)

[](#modo-silencioso-sem-exceções)

```
$manager = new IntegrityManager(
    apiUrl: 'https://api.28facil.com.br',
    throwExceptions: false
);

$report = $manager->audit();
if (!$report->isSuccess()) {
    // Lidar com erros sem exceções
    error_log($report->getErrorMessage());
}
```

---

📊 Relatório de Auditoria
------------------------

[](#-relatório-de-auditoria)

O método `audit()` retorna um objeto `AuditReport` com:

```
$report->getStatus();           // 'healthy', 'degraded', 'down'
$report->getVersion();          // Versão da API
$report->getResponseTime();     // Tempo em ms
$report->getTimestamp();        // DateTime da checagem
$report->getChecks();           // Array de Check objects
$report->isHealthy();          // bool
$report->toArray();            // Array para JSON/log
$report->toJson();             // JSON string
```

---

🧪 Testes
--------

[](#-testes)

```
# Rodar testes
composer test

# Análise estática
composer phpstan

# Code style
composer phpcs

# Tudo junto
composer analyse
```

---

📝 Exemplo: Monitoramento Contínuo
---------------------------------

[](#-exemplo-monitoramento-contínuo)

```
// Script para cron job (a cada 5 minutos)
use AiVoPro\Integrity\IntegrityManager;

$manager = new IntegrityManager('https://api.28facil.com.br');
$report = $manager->audit();

if (!$report->isHealthy()) {
    // Enviar alerta
    mail(
        'admin@28facil.com.br',
        '⚠️ API 28Fácil com problemas',
        $report->toJson()
    );

    // Log
    error_log('[28Fácil] API Health: ' . $report->getStatus());
}
```

---

🛠️ Requisitos
-------------

[](#️-requisitos)

- PHP 8.1 ou superior
- Extensões: `json`, `curl`
- Composer

---

📄 Licença
---------

[](#-licença)

MIT License - veja [LICENSE](LICENSE) para detalhes.

---

🤝 Contribuindo
--------------

[](#-contribuindo)

Contribuições são bem-vindas! Por favor:

1. Fork o projeto
2. Crie uma branch para sua feature (`git checkout -b feature/MinhaFeature`)
3. Commit suas mudanças (`git commit -m 'Add: Nova funcionalidade'`)
4. Push para a branch (`git push origin feature/MinhaFeature`)
5. Abra um Pull Request

---

📧 Suporte
---------

[](#-suporte)

- **Website**: [28facil.com.br](https://28facil.com.br)
- **Email**:
- **Issues**: [GitHub Issues](https://github.com/OARANHA/28facil-integrity/issues)

---

**Desenvolvido com ❤️ pela equipe 28Fácil / AiVoPro**

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance49

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/25003706?v=4)[A.Aranha](/maintainers/OARANHA)[@OARANHA](https://github.com/OARANHA)

---

Top Contributors

[![OARANHA](https://avatars.githubusercontent.com/u/25003706?v=4)](https://github.com/OARANHA "OARANHA (27 commits)")

### Embed Badge

![Health badge](/badges/aivopro-integrity/health.svg)

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

###  Alternatives

[mews/purifier

Laravel 5/6/7/8/9/10 HtmlPurifier Package

2.0k18.7M143](/packages/mews-purifier)[paragonie/ecc

PHP Elliptic Curve Cryptography library

24820.0k37](/packages/paragonie-ecc)

PHPackages © 2026

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