PHP Classes

Laravel PHP Human Readable Number: Format numbers, dates, times to be human readable

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 34 All time: 11,027 This week: 455Up
Version License PHP version Categories
laravel-readable 1.0.0Custom (specified...5PHP 5, Text processing, Data types
Description 

Author

This package can be used to format numbers, dates, times to be human readable.

It comes with a Laravel service provider and a class that provide several functions for formatting several types of values to make them more human readable. Currently it can:

- Format numbers with commas and decimal points
- Format date and times with spaces betweem each part of the values
- Format file sizes to make the appear either in KB, MB, GB or TB

Picture of Moamen Eltouny
  Performance   Level  
Name: Moamen Eltouny <contact>
Classes: 38 packages by
Country: Egypt Egypt
Age: 31
All time rank: 257626 in Egypt Egypt
Week rank: 206 Up3 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 22x

Documentation

[RaggiTech] Laravel >= 6.0 - Readable. Latest Stable Version Total Downloads License

Laravel Readable provides a quick and easy functions & blade directives.

  • ###### Number. (1,020,304,050,607,080)
  • ###### HumanNumber. ( 77K || 77.4K || 77.37K )
  • ###### Decimal. ( 60,708.547 )
  • ###### Date. ( 24 April 2020 )
  • ###### Time. ( 15:20 || 15:20:22 || 03:20 PM || 03:20:22 PM )
  • ###### DateTime. ( Friday, April 24, 2020 05:20 PM )
  • ###### DateTime Difference. ( 27 years before )
  • ###### Time Length. ( 4 years 7 months 1 week 3 days 9 hours 50 minutes 10 seconds )
  • ###### DateTime Length. ( 27 years - 1 week - 7 minutes - 7 seconds before )
  • ###### File Size. ( 70 GB )

Install

Install the latest version using Composer:

$ composer require raggitech/laravel-readable

Usage

Readable has the following methods & directives: - ReadableNumber() - ReadableHumanNumber() - ReadableDecimal() - ReadableDate() - ReadableTime() - ReadableDateTime() - ReadableDiffDateTime() - ReadableTimeLength() - ReadableDateTimeLength() - ReadableSize()

<a name="ReadableNumber"></a>

ReadableNumber (int $number)
1,020,304,050,607,080

<a name="ReadableHumanNumber"></a>

ReadableHumanNumber (int $number, bool $showDecimal = false, int $decimals = 0)
77K || 77.4K || 77.37K

<a name="ReadableDecimal"></a>

ReadableDecimal ($number, int $decimals = 2)
60,708.54

<a name="ReadableDate"></a>

ReadableDate ($date, string $timezone = null)

> $date = '24-04-2020' || Carbon Instance

24 April 2020

<a name="ReadableTime"></a>

ReadableTime ($time, $is12Hours = false, bool $hasSeconds = false, string $timezone = null)

> $time = '15:20:22' || Carbon Instance

Has Seconds 15:20:22 || 03:20:22 PM
Hasn't Seconds 15:20 || 03:20 PM

<a name="ReadableDateTime"></a>

ReadableDateTime ($datetime, $is12Hours = false, bool $hasSeconds = false, string $timezone = null)

> $datetime = '24-04-2020 17:20:32' || Carbon Instance

12Hours + Has Seconds => Friday, April 24, 2020 05:20:32 PM

<a name="ReadableDiffDateTime"></a>

ReadableDiffDateTime ($oldDateTime, $newDateTime = null, string $timezone = null)

> $oldDateTime = '24-04-2020 17:20:32' || Carbon Instance > $newDateTime = '24-04-2020 17:20:32' || Carbon Instance || null (now)

27 years before

<a name="ReadableTimeLength"></a>

ReadableTimeLength (int $seconds, string $comma = ' ')
4 years 7 months 1 week 3 days 9 hours 50 minutes 10 seconds
Comma => 4 years - 7 months - 1 week - 3 days - 9 hours - 50 minutes - 10 seconds

<a name="ReadableDateTimeLength"></a>

ReadableDateTimeLength ($oldDateTime, $newDateTime = null, bool $fullForm = false, string $comma = ' ', string $timezone = null)

> $oldDateTime = '24-04-2020 17:20:32' || Carbon Instance > $newDateTime = '24-04-2020 17:20:32' || Carbon Instance || null (now)

Short-Form => 27 years before
Full-Form + Comma => 27 years - 1 week - 7 minutes - 7 seconds before

<a name="ReadableSize"></a>

ReadableSize (int $bytes)
70 GB

License

MIT license


  Files folder image Files (6)  
File Role Description
Files folder imagesrc (3 files)
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files (6)  /  src  
File Role Description
  Accessible without login Plain text file Helpers.php Aux. Auxiliary script
  Plain text file Readable.php Class Class source
  Plain text file ReadableServiceProvider.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:34
This week:0
All time:11,027
This week:455Up