PHPackages                             ravjanisz/objectsize - 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. ravjanisz/objectsize

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

ravjanisz/objectsize
====================

objectsize

418PHPCI failing

Since Oct 22Pushed 6y agoCompare

[ Source](https://github.com/ravjanisz/objectsize)[ Packagist](https://packagist.org/packages/ravjanisz/objectsize)[ RSS](/packages/ravjanisz-objectsize/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependenciesVersions (1)Used By (0)

objectsize
==========

[](#objectsize)

[![Build Status](https://camo.githubusercontent.com/3af2294dcb332532828ac04d98eb3093fd5422287e313262f0996f63f719dc60/68747470733a2f2f7472617669732d63692e6f72672f7261766a616e69737a2f6f626a65637473697a652e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/ravjanisz/objectsize)[![codecov](https://camo.githubusercontent.com/20591b748ee4f024c7e8994b2435d0bbc44b8e43a536db63b907b6d9e3257fd0/68747470733a2f2f636f6465636f762e696f2f67682f7261766a616e69737a2f6f626a65637473697a652f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/ravjanisz/objectsize)

Converts file or directory to human readable number by taking the number of that unit that the bytes will go into it.

Requirements
------------

[](#requirements)

- PHP &gt;= 7.1
- ravjanisz/readablesize
- (optional) PHPUnit to run tests.

Install
-------

[](#install)

Via Composer:

```
$ composer require ravjanisz/objectsize
```

Usage
-----

[](#usage)

```
//settings and object instance
use Rav\Size\SizeSettings;
use Rav\ObjectSize\ObjectSize;

//create settings for human readable size
$settings = new SizeSettings();
$settings->setPrecision(2);

//create object instance
$object = new ObjectSize($settings);
//set file/dir path
$object->setPath(__DIR__ . '/files/shark.jpeg');
//get value
echo $object->human();
//get value in bytes
echo $object->inBytes();

//set file/dir path
$object->setPath(__DIR__ . '/files');
//get value
echo $object->human();
//get value in bytes
echo $object->inBytes();
```

Documentation
-------------

[](#documentation)

None

Support the development
-----------------------

[](#support-the-development)

**Do you like this project? Support it by donating**

[![alt Buy me a coffee](https://raw.githubusercontent.com/ravjanisz/objectsize/master/docs/assets/bmc.png)](https://www.buymeacoffee.com/ravjanisz)License
-------

[](#license)

objectsize is licensed under the MIT License - see the LICENSE file for details

###  Health Score

19

—

LowBetter than 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity35

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28200514?v=4)[Rafał Janisz](/maintainers/ravjanisz)[@ravjanisz](https://github.com/ravjanisz)

---

Top Contributors

[![ravjanisz](https://avatars.githubusercontent.com/u/28200514?v=4)](https://github.com/ravjanisz "ravjanisz (4 commits)")

### Embed Badge

![Health badge](/badges/ravjanisz-objectsize/health.svg)

```
[![Health](https://phpackages.com/badges/ravjanisz-objectsize/health.svg)](https://phpackages.com/packages/ravjanisz-objectsize)
```

###  Alternatives

[agence-adeliom/easy-editor-bundle

A Symfony bundle for EasyAdmin that provide a flexible content editor

1111.0k1](/packages/agence-adeliom-easy-editor-bundle)

PHPackages © 2026

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