Download the PHP package muhammad-zahid/universaldate without Composer
On this page you can find all versions of the php package muhammad-zahid/universaldate. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download muhammad-zahid/universaldate
More information about muhammad-zahid/universaldate
Files in muhammad-zahid/universaldate
Package universaldate
Short Description This package will convert any type of date to human readable date
License MIT
Informations about the package 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
- 🔄 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
- PHP 7.4 or higher
- Laravel 8.0+ (for Laravel integration)
Installation
Install the package via Composer:
Basic Usage
Laravel Integration
The package includes Laravel integration with a Facade for convenient usage.
Using the Facade
Using Dependency Injection
Available 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)
make(string|int|DateTime $date = 'now', ?string $timezone = 'UTC'): UniversalDate
Creates a new UniversalDate instance
License
The UniversalDate package is open-sourced software licensed under the MIT license.
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
If you have any questions or run into any issues, please create an issue on the GitHub repository.