Skip to content

Easily get name of weekday and value from name between different languages.

License

Notifications You must be signed in to change notification settings

chinleung/php-weekday

Repository files navigation

PHP Weekday

Latest Version on Packagist Build Status Quality Score Total Downloads

Easily get name of weekday and value from name between different languages.

Installation

You can install the package via composer:

composer require chinleung/php-weekday

Usage

Retrieve a name from a value

Weekday::getNameFromValue(0, 'en'); // Sunday
(new Weekday(0, 'en'))->getName(); // Sunday

Retrieving a name from a value for a different locale

Weekday::getNameFromValue(0, 'fr'); // Dimanche
(new Weekday(0, 'en'))->getName('fr'); // Dimanche

Retrieving a value from the name

Weekday::getValueFromName('Sunday', 'en'); // 0
Weekday::getValueFromName('Lundi', 'fr'); // 1
(new Weekday('wednesday', 'en'))->getName(); // 3

Retrieving all names for a locale

Weekday::getNames('en'); // ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']

Changing the locale of an instance

(new Weekday(1, 'en'))->setLocale('fr')->getName(); // Lundi

Testing

composer test

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

PHP Package Boilerplate

This package was generated using the PHP Package Boilerplate.

About

Easily get name of weekday and value from name between different languages.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages