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 implementsMediaScanner 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.
Processor that transforms content
Processors run in the configured order before persistence. Return the samePreparedMedia or a new owned snapshot. This example uses an application-provided PDF sanitizer:
Custom access policy
manage-attachment in your application’s authorization layer. It must handle create uploads where record is null and enforce ownership of any supplied receipt.
Custom storage adapter
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
replace flag. Names are lowercase identifiers; each group supports up to 64 registered extensions.
Custom image encoder
Bind your ownBjanczak\FilamentFlexFields\Support\Media\Contracts\ImageEncoder implementation when you need Imagick, libvips, ICC preservation or an external image service:
PreparedMedia. Storage, scanning and verification remain with Media OS.
Stored event
Rejected event
Deleted event
Complete image bundle event
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
Usestore(..., 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.