Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/oskarstark/readable-filesize-extension
A Twig extension to convert filesize to human readable string.
https://github.com/oskarstark/readable-filesize-extension
Last synced: 5 days ago
JSON representation
A Twig extension to convert filesize to human readable string.
- Host: GitHub
- URL: https://github.com/oskarstark/readable-filesize-extension
- Owner: OskarStark
- License: mit
- Created: 2021-03-19T12:04:37.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-04-24T11:21:32.000Z (7 months ago)
- Last Synced: 2024-05-02T01:39:37.597Z (6 months ago)
- Language: PHP
- Homepage:
- Size: 69.3 KB
- Stars: 4
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# readable-filesize-extension
A Twig extension to convert filesize to human readable string.
[![CI][ci_badge]][ci_link]
## Installation
```
composer require oskarstark/readable-filesize-extension
``````yaml
# config/services.yaml
services:
OskarStark\Twig\ReadableFilesizeExtension:
tags: ['twig.extension']
```## Usage
```twig
// file.size = 1024{{ file.size|readable_filesize() }} # prints '1 KB'
{{ file.size|readable_filesize(2) }} # prints '1.00 KB'
```[ci_badge]: https://github.com/OskarStark/readable-filesize-extension/workflows/CI/badge.svg?branch=main
[ci_link]: https://github.com/OskarStark/readable-filesize-extension/actions?query=workflow:ci+branch:main