2017 © Pedro Peláez
 

library enum

SPL inspired PHP enum class implementation

image

konekt/enum

SPL inspired PHP enum class implementation

  • Saturday, June 9, 2018
  • by konekt
  • Repository
  • 5 Watchers
  • 7 Stars
  • 7,505 Installations
  • PHP
  • 5 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 13 Versions
  • 53 % Grown

The README.md

Konekt Enum

Tests Packagist Stable Version Packagist downloads StyleCI MIT Software License, (*1)

PHP Enum Class

Enums are handy when a variable (especially a method parameter) can only take one out of a small set of possible values., (*2)

Konekt Enum is a lightweight abstract class that enables creation of PHP enums., (*3)

Why not PHP 8.1 Enums? This package was created back in 2013, and has been in use across many libraries. We're planning to find the way to make this package be based on native PHP enums AND keep compatibility with earlier versions as much as possible. This is expected in the v5.0 release of this package., (*4)

Usage

Extend the base class and define constants on it:, (*5)

Example
class ChessPiece extends \Konekt\Enum\Enum {
    const KING   = 'king';
    const QUEEN  = 'queen';
    const ROOK   = 'rook';
    const BISHOP = 'bishop';
    const KNIGHT = 'knight';
    const PAWN   = 'pawn';
}

var $queen = new ChessPiece('queen');

Installation

using composer: composer require konekt/enum, (*6)

Documentation

For detailed usage and examples go to the Konekt Enum Documentation or refer to the markdown files in the docs/ folder of this repo., (*7)

For the list of changes read the Changelog., (*8)

Upgrade

Laravel Eloquent Integration

There is a tiny trait for Laravel that helps you to automatically map fields of Eloquent models to/from Enum objects. For more details go to the konekt/enum-eloquent package., (*9)

The Versions

09/06 2018

dev-master

9999999-dev

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

enum konekt artkonekt

09/06 2018

2.1.1

2.1.1.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

enum konekt artkonekt

13/10 2017

2.1.0

2.1.0.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

enum konekt artkonekt

06/10 2017

dev-analysis-zOdjlR

dev-analysis-zOdjlR

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

enum konekt artkonekt

26/09 2017

2.0.2

2.0.2.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

enum konekt artkonekt

14/09 2017

2.0.1

2.0.1.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

enum konekt artkonekt

13/09 2017

2.0.0

2.0.0.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=7.0.0

 

The Development Requires

enum konekt artkonekt

14/12 2016

1.2.0

1.2.0.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

enum konekt artkonekt

14/12 2016

1.2.x-dev

1.2.9999999.9999999-dev

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

enum konekt artkonekt

06/07 2016

1.1.0

1.1.0.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

enum konekt artkonekt

31/05 2016

1.0.2

1.0.2.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

enum konekt artkonekt

30/05 2016

1.0.1

1.0.1.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

enum konekt artkonekt

30/05 2016

1.0.0

1.0.0.0

SPL inspired PHP enum class implementation

  Sources   Download

MIT

The Requires

  • php >=5.5.9

 

The Development Requires

enum konekt artkonekt