A very simple PHP Enum implementation.
Via Composer
$ composer require bbrothers/enum
class Weekdays extends Enum
{
const MONDAY = 'monday';
const TUESDAY = 'tuesday';
const WEDNESDAY = 'wednesday';
const THURSDAY = 'thursday';
const FRIDAY = 'friday';
}
// ...
$day = Weekdays::TUESDAY();
$day->equals(Weekdays::MONDAY()); // false
$day->isSelected(Weekdays::TUESDAY); // true
(string) $day; // tuesday
Weekdays::values(); // monday, tuesday, wednesday, thursday, friday
Weekdays::keys(); // MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY
Please see CHANGELOG for more information on what has changed recently.
$ composer test
Please see CONTRIBUTING and CONDUCT for details.
The MIT License (MIT). Please see License File for more information.