tourze/easy-admin-file-size-field-bundle
A Symfony bundle that adds a file size field type to EasyAdmin, letting you display and edit file sizes cleanly in admin forms and CRUD pages with consistent formatting and simple integration.
This bundle adds a file-size field type to Tourze EasyAdmin, so a raw byte count stored on an entity (e.g. size on a Media/Document/Attachment model) can be displayed as a human-readable value (1.4 MB) and, where supported, edited or validated in forms.
config/bundles.php if it doesn't appear):
composer require tourze/easy-admin-file-size-field-bundle:^1.0
src/ for the field class (typically a Field/FieldConfigurator/FieldFactory implementation) and any templates/ directory — that tells you the exact option names before you write config.configureFields() for the index/detail pages instead of the raw IntegerField, so operators stop reading 10485760 and start reading 10 MB.Because 1.0.0 is the first stable tag after 0.0.3, treat the published API as now-frozen but verify the actual class names and option signatures in the repo before wiring them in — the release notes only contain a diff link.
index/detail pages and keep the underlying numeric field (or a hidden input) on new/edit so the stored value stays a byte integer.$file->getSize() returning bytes and let the field handle unit selection; this keeps sorting, filtering and API output correct.FileField (upload) + this field (size display). Compute size on persist ($file->setSize(filesize($path))) rather than trusting the client.size column and only render the formatted string — otherwise "9 MB" sorts after "10 MB".1.0.0 freshly cut, pin ^1.0 in composer.json and commit the lockfile so a later 1.x patch can't silently change formatting output in admin screenshots/tests.git diff 0.0.3..1.0.0 for renamed options or changed constructor signatures before upgrading. Anything public in 0.0.3 may have shifted.filesize() conventions) or 1000. A mismatch with what your storage layer or OS reports will produce "wrong" sizes in admin and erode trust in the tool.0 bytes and null (unpersisted upload) often render as 0 B or throw; decide explicitly and override the template if the default is unhelpful.BIGINT and the field casts to int/float rather than string-mathing.1,4 MB vs 1.4 MB), which breaks copy-pasted values and snapshot tests. Check for a decimals/locale option.templates/bundles/... rather than editing vendor/ — but re-check after each 1.x bump, since template block names are a common breaking point.How can I help you explore Laravel packages today?