PHPackages                             muhammad-zahid/universaldate - 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. muhammad-zahid/universaldate

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

muhammad-zahid/universaldate
============================

This package will convert any type of date to human readable date

v1.1.3(1y ago)09MITPHPPHP ^7.4|^8.0

Since Jan 5Pushed 1y ago1 watchersCompare

[ Source](https://github.com/ZahidKhan1100/universal-date)[ Packagist](https://packagist.org/packages/muhammad-zahid/universaldate)[ RSS](/packages/muhammad-zahid-universaldate/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (15)Used By (0)

UniversalDate
=============

[](#universaldate)

A powerful PHP package for converting dates into human-readable formats with Laravel integration support. Convert any type of date format into user-friendly, readable text with support for multiple languages and "time ago" formatting.

Features
--------

[](#features)

- 🔄 Convert any date format to human-readable text
- ⏰ "Time ago" formatting (e.g., "2 hours ago", "in 3 days")
- 🌍 Timezone support
- 🔌 Seamless Laravel integration
- 🎯 Support for multiple date input formats (string, timestamp, DateTime)
- 🛠️ Customizable output formats
- 🚀 Simple and intuitive API

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

[](#requirements)

- PHP 7.4 or higher
- Laravel 8.0+ (for Laravel integration)

Installation
------------

[](#installation)

Install the package via Composer:

```
composer require muhammad-zahid/universaldate
```

Basic Usage
-----------

[](#basic-usage)

```
use MuhammadZahid\UniversalDate\UniversalDate;

// Initialize with current date
$date = new UniversalDate();
echo $date->toHuman(); // "January 5, 2024 at 9:30 PM"

// Initialize with a specific date
$date = new UniversalDate('2023-12-25');
echo $date->toHuman(); // "December 25, 2023 at 12:00 AM"

// Time ago format
$date = new UniversalDate('2023-12-25');
echo $date->toTimeAgo(); // "11 days ago"

// Custom format
$date = new UniversalDate('2023-12-25');
echo $date->format('Y-m-d'); // "2023-12-25"

// With timezone
$date = new UniversalDate('2023-12-25', 'America/New_York');
echo $date->toHuman(); // Shows date in New York timezone
```

Laravel Integration
-------------------

[](#laravel-integration)

The package includes Laravel integration with a Facade for convenient usage.

### Using the Facade

[](#using-the-facade)

```
use MuhammadZahid\UniversalDate\Facades\UniversalDate;

// Quick usage
echo UniversalDate::toHuman(); // Current date in human format

// Chain methods
echo UniversalDate::make('2023-12-25')
    ->setTimezone('America/New_York')
    ->toHuman();

// Time ago
echo UniversalDate::make('2023-12-25')->toTimeAgo();
```

### Using Dependency Injection

[](#using-dependency-injection)

```
use MuhammadZahid\UniversalDate\UniversalDate;

class DateController
{
    public function show(UniversalDate $date)
    {
        return $date->toHuman();
    }
}
```

Available Methods
-----------------

[](#available-methods)

### Main Methods

[](#main-methods)

- `toHuman(?string $format = null): string`Converts date to human-readable format
- `toTimeAgo(): string`Shows relative time (e.g., "2 hours ago")
- `format(string $format): string`Formats date according to specified format string
- `getDateTime(): DateTime`Returns the underlying DateTime instance
- `setTimezone(string $timezone): self`Sets the timezone for the date

### Static Creation (Laravel Facade)

[](#static-creation-laravel-facade)

- `make(string|int|DateTime $date = 'now', ?string $timezone = 'UTC'): UniversalDate`Creates a new UniversalDate instance

License
-------

[](#license)

The UniversalDate package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

Contributing
------------

[](#contributing)

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

Support
-------

[](#support)

If you have any questions or run into any issues, please create an issue on the GitHub repository.

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance41

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~0 days

Total

13

Last Release

492d ago

PHP version history (2 changes)v1.0.0PHP ^7.4

v1.0.1PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/de187c47b0e49de9fc5bbb572303d94e9a2ac320d3b4c8143135640b7a846a02?d=identicon)[imuhammadzahid](/maintainers/imuhammadzahid)

---

Top Contributors

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

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/muhammad-zahid-universaldate/health.svg)

```
[![Health](https://phpackages.com/badges/muhammad-zahid-universaldate/health.svg)](https://phpackages.com/packages/muhammad-zahid-universaldate)
```

###  Alternatives

[barryvdh/laravel-ide-helper

Laravel IDE Helper, generates correct PHPDocs for all Facade classes, to improve auto-completion.

14.9k123.0M687](/packages/barryvdh-laravel-ide-helper)[orchestra/canvas

Code Generators for Laravel Applications and Packages

21017.2M158](/packages/orchestra-canvas)[illuminate/pipeline

The Illuminate Pipeline package.

9446.6M213](/packages/illuminate-pipeline)[illuminate/pagination

The Illuminate Pagination package.

10532.5M862](/packages/illuminate-pagination)[spatie/laravel-pjax

A pjax middleware for Laravel 5

513371.8k11](/packages/spatie-laravel-pjax)[spatie/laravel-mix-preload

Add preload and prefetch links based your Mix manifest

169176.0k2](/packages/spatie-laravel-mix-preload)

PHPackages © 2026

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