PHPackages                             sedur/filament-anexo-field - 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. sedur/filament-anexo-field

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

sedur/filament-anexo-field
==========================

v0.1.20(3mo ago)0979—0%MITPHP

Since Sep 13Pushed 3mo agoCompare

[ Source](https://github.com/sedurba/filament-anexo-field)[ Packagist](https://packagist.org/packages/sedur/filament-anexo-field)[ RSS](/packages/sedur-filament-anexo-field/feed)WikiDiscussions main Synced 3d ago

READMEChangelogDependencies (2)Versions (22)Used By (0)

Filament Anexo Field
====================

[](#filament-anexo-field)

[![Latest Version on Packagist](https://camo.githubusercontent.com/d07ab2843d2c90732de67814eeb9ad70a5748748044df3b5abfd136a0bb8562c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73656475722f66696c616d656e742d616e65786f2d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sedur/filament-anexo-field)[![Total Downloads](https://camo.githubusercontent.com/be236655545479b66ed6f95e6fb39f8c5bd2aa0fbc6d1b2629b720c309add49c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f73656475722f66696c616d656e742d616e65786f2d6669656c642e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/sedur/filament-anexo-field)

Um campo customizado para [FilamentPHP](https://filamentphp.com/) que permite upload de anexos com **workflow de múltiplos passos** e feedback em tempo real usando **SweetAlert2**.

---

📋 Requerimentos
---------------

[](#-requerimentos)

- [Laravel 11+](https://laravel.com)
- [Filament 4.x](https://filamentphp.com)
- PHP 8.2 ou superior
- [Livewire 3.x](https://livewire.laravel.com)
- [SweetAlert2](https://sweetalert2.github.io/) instalado via NPM:

```
npm install sweetalert2
```

---

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

[](#-instalação)

Via composer (Packagist):

```
composer require sedur/filament-anexo-field
```

---

⚙️ Configuração
---------------

[](#️-configuração)

O Service Provider é registrado automaticamente pelo Laravel.

### Publicar configuração

[](#publicar-configuração)

```
php artisan vendor:publish --tag="sedur::filament-anexo-field-config"
```

Arquivo publicado: `config/sedur-anexo-field.php`

```
return [
    // Disco de upload usado pelo Storage
    'upload_disk' => env('SEDUR_ANEXO_FIELD_DISK', env('FILESYSTEM_DISK', 'public')),
];
```

### Publicar views (se quiser sobrescrever)

[](#publicar-views-se-quiser-sobrescrever)

```
php artisan vendor:publish --tag="sedur::filament-anexo-field-views"
```

---

🚀 Uso
-----

[](#-uso)

### 1. Adicione o trait na Page ou Livewire Form

[](#1-adicione-o-trait-na-page-ou-livewire-form)

```
use Sedur\FilamentAnexoField\Concerns\HasAnexoField;

class DocumentoCreate extends CreateRecord
{
    use HasAnexoField;
}
```

### 2. Adicione o campo no schema do formulário

[](#2-adicione-o-campo-no-schema-do-formulário)

```
use Sedur\FilamentAnexoField\Components\AnexoField;

AnexoField::make('campo_formulario')
    ->directory(fn() => 'exemplo/art')
    ->workflow([
        AnexoField::step('Preparando documento', function ($arquivo, $contexto) {
            sleep(1);
            $contexto['step1'] = true;
            return $contexto;
        }),
        AnexoField::step('Analisando dados', function ($arquivo, $contexto) {
            sleep(1);
            $contexto['step2'] = true;
            $contexto['finalizar'] = true;
            return $contexto;
        }),
    ])
    ->catch(function ($arquivo, $contexto, $codigoErro) {
        return [
            'titulo' => 'Erro',
            'descricao' => 'Falha ao processar',
        ];
    });
```

---

🔄 Como funciona
---------------

[](#-como-funciona)

1. **Upload inicial**

    - O arquivo é salvo via Livewire no disco configurado (`sedur-anexo-field.upload_disk`).
2. **Execução de steps**

    - Cada step é definido via `AnexoField::step($titulo, $callback, $timeoutMs)`.
    - O callback PHP recebe:
        - `$arquivo`: caminho final do arquivo no storage.
        - `$contexto`: array que acumula dados entre os steps.
    - O retorno do callback é mesclado ao `$contexto`.
3. **Finalização antecipada**

    - Se o callback setar `$contexto['finalizar'] = true`, o workflow encerra imediatamente com sucesso.
4. **Tratamento de erro**

    - Se qualquer callback lançar exceção, é chamado o `catch()` definido no campo.

---

📜 Licença
---------

[](#-licença)

Este pacote é open-souce sob a licença [MIT](LICENSE).

---

### 💡 Créditos

[](#-créditos)

Desenvolvido por [CryptoManiacMS](https://github.com/CryptoManiacMS).

###  Health Score

36

—

LowBetter than 79% of packages

Maintenance78

Regular maintenance activity

Popularity17

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 80% 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 ~9 days

Recently: every ~0 days

Total

21

Last Release

114d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/216205537?v=4)[SEDUR - Salvador/BA](/maintainers/sedurba)[@sedurba](https://github.com/sedurba)

---

Top Contributors

[![acto-mauriciodias](https://avatars.githubusercontent.com/u/137586916?v=4)](https://github.com/acto-mauriciodias "acto-mauriciodias (20 commits)")[![sedurba](https://avatars.githubusercontent.com/u/216205537?v=4)](https://github.com/sedurba "sedurba (5 commits)")

### Embed Badge

![Health badge](/badges/sedur-filament-anexo-field/health.svg)

```
[![Health](https://phpackages.com/badges/sedur-filament-anexo-field/health.svg)](https://phpackages.com/packages/sedur-filament-anexo-field)
```

###  Alternatives

[ysfkaya/filament-phone-input

A phone input component for Laravel Filament

3161.3M25](/packages/ysfkaya-filament-phone-input)[stephenjude/filament-feature-flags

Filament implementation of feature flags and segmentation with Laravel Pennant.

122177.8k1](/packages/stephenjude-filament-feature-flags)[marcelweidum/filament-expiration-notice

Customize the livewire expiration notice

94135.4k5](/packages/marcelweidum-filament-expiration-notice)[crumbls/layup

A visual page builder plugin for Filament 5 — Divi-style grid layouts with extensible widgets.

592.7k2](/packages/crumbls-layup)[eduardoribeirodev/filament-leaflet

Um widget de mapa para FilamentPHP.

2118.9k](/packages/eduardoribeirodev-filament-leaflet)[rawilk/profile-filament-plugin

Profile &amp; MFA starter kit for filament.

3914.6k](/packages/rawilk-profile-filament-plugin)

PHPackages © 2026

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