Download the PHP package iqomp/enum without Composer

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

iqomp/enum

Static data enum provider. This module provide list of enums that may used by application.

Installation

Publishing Config

Configuration

To add new enum data or modify exists one, modify file on /config/autoload/enum.php to return data as below:

Or if you prefer to use file ConfigProvider.php, add data as below:

Make sure to update your composer.json file to let hyperf identify the config file:

Translation

If you want the enum label to be translated, make sure to install module hyperf/translation. Add new translation on folder storage/languages/vendor/enum/{locale}/{enum-name}.php.

Usage

Use class Iqomp\Enum\Enum to create enum object with specified value.

Method

List of method defined by this class object:

__construct(string $name, $value=null, string $type=null): Enum

Create new Enum object. This method accept parameters:

  1. name::string The name of enum datalist.
  2. value::int|str The value of enum item.
  3. type::string Convert provided value as int or str.

__get($name): mixed

Get enum data property, accepted name are value, label, and options.

__toString(): string

Return string enum label.

jsonSerialize()

Convert the enum to json_encode ready parameter.

Form Validator

If you're using validator iqomp/validator for your object or form validator, this module add new form validator rule named enum to validate if user provided data is in registered enum.

enum => name

Make sure user provided value is in registered enum, the value of user posted data can be single int/str or array of it.

Linter

Run below script to run psr-12 linter:

Formatter

If you're using formatter iqomp/formatter for your object formatter, this module add new object format type named enum and multiple-enum that can be use to convert object property value to enum object.

enum

Convert current object property value to Iqomp\Enum\Enum object.

multiple-enum

Convert current object property value to array of Iqomp\Enum\Enum with custom separator:

If property separator is not set, PHP_EOL will be used. It also accept separator 'json' that will use json_decode for separation. If the value of object property is already array, no separation/explode will used.


All versions of enum with dependencies

PHP Build Version
Package Version
No informations.
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 iqomp/enum contains the following files

Loading the files please wait ....