chinleung / php-weekday
Easily get name of weekday and value from name between different languages.
Installs: 8 517
Dependents: 1
Suggesters: 0
Security: 0
Stars: 1
Watchers: 2
Forks: 0
Open Issues: 1
Requires
- php: ^7.1
- chinleung/verbose-localization: ^1.0
Requires (Dev)
- phpunit/phpunit: ^7.0
This package is auto-updated.
Last update: 2024-11-28 05:12:35 UTC
README
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 hello@chinleung.com 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.