Skip to main content
Register named extension factories in your application service provider’s boot() method. Examples with App\... services refer to services supplied by your own application. Factories resolve within the current Laravel request/job scope.

Antivirus scanner

Media OS has an integration contract, not a built-in antivirus engine. Your scanner implements MediaScanner and returns normally only after its provider certifies clean content.
AntivirusClient is your provider client, for example a ClamAV connector or an external scanning service. Its timeout/unavailable/unknown results must not be treated as clean.
Require scanning for a write:
Every registered scanner must succeed at enabled boundaries. Required scanning without a provider rejects the operation. Keep quarantine private.

Processor that transforms content

Processors run in the configured order before persistence. Return the same PreparedMedia or a new owned snapshot. This example uses an application-provided PDF sanitizer:
Your sanitizer client must return its own temporary file. The returned prepared snapshot is independent of that temporary output. Do not close or mutate the borrowed input. Register and select the processor:
Processors are also suitable for normalizing a source into a smaller master before storage. Their output is remeasured and must still satisfy policy. Conversions alone retain the original.

Custom access policy

Define manage-attachment in your application’s authorization layer. It must handle create uploads where record is null and enforce ownership of any supplied receipt.
Policies cover operations such as inspect, store, verify, URL access, delete, convert, recovery and metadata where invoked by the integration. They supplement your form/record authorization. Background workers must have the tenant context required by these policies.

Custom storage adapter

Implement Bjanczak\FilamentFlexFields\Support\Media\Contracts\MediaAdapter: A failed write must clean up partial objects before a receipt exists. Implement MediaReceiptResolver if native adapter objects must be reconstructed from durable receipts. Disk FLEX fields need path-compatible references; an adapter with arbitrary IDs needs a matching field integration.

Replace a registration

Use explicit replacement when overriding an already registered name. Adapter, processor and policy registration support the same replace flag. Names are lowercase identifiers; each group supports up to 64 registered extensions.

Custom image encoder

Bind your own Bjanczak\FilamentFlexFields\Support\Media\Contracts\ImageEncoder implementation when you need Imagick, libvips, ICC preservation or an external image service:
The encoder must honor the typed conversion, input/output policy and limits, and return owned PreparedMedia. Storage, scanning and verification remain with Media OS.

Stored event

Rejected event

Deleted event

Complete image bundle event

This synchronous-bundle event means all requested variants are ready. Individual MediaStored events apply to each stored object. For queued conversions use their processing status; do not treat original storage as variant completion.

Acceptance checks and notifications

Use store(..., finalize: ...) for a pre-publication veto. Use events for notifications after the operation. Listener failure is reported and does not reverse committed media. If you need guaranteed delivery to another system, use your application’s transactional outbox and deduplicate by operation ID. For upload-specific stored/accepted events and browser progress observations, see FLEX events.
Last modified on October 16, 2026