Download the PHP package dkd/enumeration without Composer

On this page you can find all versions of the php package dkd/enumeration. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package enumeration

PHP Enumeration

This is a native PHP implementation to add enumeration support to PHP >= 5.3. It's an abstract class that needs to be extended to use it.

Usage

Basics

use Dkd\Enumeration;

class MyEnumeration extends Enumeration
{
    // this is optional. The value will be used as default value if no value
    // is given.
    const __DEFAULT = self::INTEGER_VALUE;

    // all scalar datatypes are supported
    const INTEGER_VALUE = 1;
    const FLOAT_VALUE = 0.123;
    const STRING_VALUE = 'foo';
    const BOOLEAN_VALUE = true;
}

// Use the  value if defined. If not defined an exception
// is thrown.
$myEnumeration = MyEnumeration();

$myEnumeration = new MyEnumeration(MyEnumeration::INTEGER_VALUE);

// cast does automatically cast the given value to the enumeration value.
$myEnumeration = MyEnumeration::cast(MyEnumeration::INTEGER_VALUE);
$myEnumeration = MyEnumeration::cast($myEnumeration);
$myEnumeration = MyEnumeration::cast($databaseResult['my_column']);

// get all possible values of the enumeration.
$possibleValues = MyEnumeration::getConstants();

$myEnumeration = new MyEnumeration(MyEnumeration::INTEGER_VALUE);
$myEnumeration->equals(1); // TRUE
$myEnumeration->equals($myEnumeration); // TRUE
$myEnumeration->equals(0.123); // FALSE
$myEnumeration->equals('foo'); // FALSE
$myEnumeration->equals(new MyEnumeration('foo')); // FALSE

Why not

Install

Composer

Add to the project's composer.json dependencies and run

GIT

ZIP / TAR

Download the last version from Github and extract it.

License

This code is also part of the TYPO3 CMS project and has been extracted to this package. See LICENSE for details.


All versions of enumeration with dependencies

PHP Build Version
Package Version
Requires php Version >=5.3
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package dkd/enumeration contains the following files

Loading the files please wait ....