Download the PHP package phpenum/phpenum without Composer

On this page you can find all versions of the php package phpenum/phpenum. 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 phpenum

PHP Enum

Latest Version on Packagist License Postcardware

PHP from Packagist Build Status Total Downloads

PHPEnum is an enumeration class library for PHP developers. The idea comes from Java enumeration, and using the PHP features to implement single-value enumeration and multi-value enumeration. PHPEnum runs in most PHP applications.

Installation

composer require phpenum/phpenum

Getting Started

Using PhpEnum is very similar to using Java Enum, For example, define an enumeration representing gender.

In Java:

public enum GenderEnum {
    MALE(1, "male"),
    FEMALE(2, "female");

    private Integer id;
    private String name;

    GenderEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return id;
    }

    public String getName() {
        return name;
    }
}

In PHP:

class GenderEnum extends \PhpEnum\Enum
{
    const MALE = [1, 'male'];
    const FEMALE = [2, 'female'];

    private $id;
    private $name;

    protected function construct($id, $name)
    {
        $this->id = $id;
        $this->name = $name;
    }

    public function getId()
    {
        return $this->id;
    }

    public function getName()
    {
        return $this->name;
    }
}

You'll also find a lot of similarities when using enumerations

In Java:

GenderEnum.values(); // enum instance array
GenderEnum.valueOf("FEMALE"); // enum instance
GenderEnum.MALE.equals(GenderEnum.valueOf("MALE")); // true
GenderEnum.MALE.name(); // MALE
GenderEnum.MALE.ordinal(); // 0
GenderEnum.MALE.toString(); // MALE
GenderEnum.MALE.getId(); // 1
GenderEnum.MALE.getName(); // male

In PHP:

GenderEnum::values(); // enum instance array
GenderEnum::valueOf('FEMALE'); // enum instance
GenderEnum::MALE()->equals(GenderEnum::valueOf('MALE')); // true
GenderEnum::MALE()->name(); // MALE
GenderEnum::MALE()->ordinal(); // 0
(string)GenderEnum::MALE(); // MALE
GenderEnum::MALE()->getId(); // 1
GenderEnum::MALE()->getName(); // male

Not only that, PhpEnum also provides advanced functionality in subclasses

GenderEnum::MALE()->idEquals(1); // true
GenderEnum::MALE()->NameEquals('male'); // true
GenderEnum::containsId(1); // 1
GenderEnum::containsName('male'); // 1
GenderEnum::ofId(1); // enum instance
GenderEnum::ofName('male'); // enum instance

Documentation

PhpEnum supports PHP version 5.6+. The documentation for PHPEnum is available on the Github wiki.

License

The PHPEnum is open-sourced software licensed under the GPL-3.0 license.


All versions of phpenum with dependencies

PHP Build Version
Package Version
Requires php Version >=5.6
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 phpenum/phpenum contains the following files

Loading the files please wait ....