Param uses ConstantsTrait
Centralized enumeration of parameter keys used across various parts of the application.
This class defines a large set of constants to avoid hard-coded string keys, enabling safer and more consistent parameter usage throughout your codebase.
Example usage:
use oihana\enums\Param;
$options = [
Param::LIMIT => 20,
Param::OFFSET => 0,
Param::ORDER => 'DESC',
Param::FILTER => ['status' => 'active'],
];
This enumeration can be used in:
- HTTP request parsers
- Configuration arrays
- Filtering and sorting logic
- CLI arguments
- Custom annotations or metadata
Optionally, you can group constants by context using a utility method like groupByPrefix().
Tags
Table of Contents
Constants
- ACTION : string = 'action'
- ACTIONS : string = 'actions'
- ACTIVABLE : string = 'activable'
- ACTIVE : string = 'active'
- AFTER : string = 'after'
- ALIAS : string = 'alias'
- ALL : string = 'all'
- ALT : string = 'alt'
- ALTER : string = 'alter'
- ALTERS : string = 'alters'
- ARGS : string = 'args'
- BASE_PATH : string = 'basePath'
- BATCH_SIZE : string = 'batchSize'
- BEFORE : string = 'before'
- BENCH : string = 'bench'
- BINDS : string = 'binds'
- BOOL : string = 'bool'
- CACHE : string = 'cache'
- CACHEABLE : string = 'cacheable'
- COLLECTION : string = 'collection'
- COMPARATOR : string = 'comparator'
- COMPRESS : string = 'compress'
- CONDITION : string = 'condition'
- CONDITIONS : string = 'conditions'
- CONFIG : string = 'config'
- CONTEXT : string = 'context'
- CONTROLLER : string = 'controller'
- CONTROLLERS : string = 'controllers'
- CUSTOM_RULES : string = 'customRules'
- DATE : string = 'date'
- DATE_FORMAT : string = 'dateFormat'
- DEBUG : string = 'debug'
- DEFAULT : string = 'default'
- DEFAULT_NOT_EQUALS : string = 'defaultNotEquals'
- DEFER_ASSIGNMENT : string = 'deferAssignment'
- DEFINITION : string = 'definition'
- DESCRIPTION : string = 'description'
- DESTROY : string = 'destroy'
- DIRECTION : string = 'direction'
- DIRECTORY : string = 'directory'
- DOC : string = 'doc'
- DOC_REF : string = 'docRef'
- DOCS : string = 'docs'
- DOCUMENT_KEY : string = 'documentKey'
- DOCUMENTS : string = 'documents'
- ENABLE : string = 'enable'
- ENABLED : string = 'enabled'
- ENCRYPT : string = 'encrypt'
- EXCLUDES : string = 'excludes'
- EXIST : string = 'exist'
- EXTENSIONS : string = 'extensions'
- EXTRA_QUERY : string = 'extraQuery'
- FACET : string = 'facet'
- FACETS : string = 'facets'
- FIELD : string = 'field'
- FIELDS : string = 'fields'
- FILE : string = 'file'
- FILTER : string = 'filter'
- FILTER_KEYS : string = 'filterKeys'
- FILTER_PATCH_AND_PUT_KEYS : string = 'filterPatchAndPutKeys'
- FILTER_PATCH_KEYS : string = 'filterPatchKeys'
- FILTER_POST_KEYS : string = 'filterPostKeys'
- FILTER_PUT_KEYS : string = 'filterPutKeys'
- FILTERABLE : string = 'filterable'
- FORCE_URL : string = 'forceUrl'
- FORMAT : string = 'format'
- FULL_PATH : string = 'fullPath'
- GROUP_BY : string = 'groupBy'
- HARVEST : string = 'harvest'
- HAS_TOTAL : string = 'hasTotal'
- HELP : string = 'help'
- HTML : string = 'html'
- I18N : string = 'i18n'
- ID : string = 'id'
- IDS : string = 'ids'
- INFLECTOR : string = 'inflector'
- INIT : string = 'init'
- INSERT : string = 'insert'
- INTERVAL : string = 'interval'
- INTERVAL_DEFAULT : string = 'interval_default'
- ITEMS : string = 'items'
- JOIN : string = 'join'
- JOINS : string = 'joins'
- JSON : string = 'json'
- JSON_OPTIONS : string = 'jsonOptions'
- KEY : string = 'key'
- KEY_LIST : string = 'keyList'
- LANG : string = 'lang'
- LAST : string = 'last'
- LAZY : string = 'lazy'
- LIMIT : string = 'limit'
- LIMIT_DEFAULT : string = 'limit_default'
- LIST : string = 'list'
- LOCATION : string = 'location'
- LOCATIONS : string = 'locations'
- LOCKABLE : string = 'lockable'
- LOGGABLE : string = 'loggable'
- LOGGER : string = 'logger'
- MARGIN : string = 'margin'
- MATCH : string = 'match'
- MAX_DEPTH : string = 'maxDepth'
- MAX_INTERVAL : string = 'maxInterval'
- MAX_LIMIT : string = 'maxLimit'
- MAX_RANGE : string = 'max_range'
- MEMCACHED : string = 'memcached'
- METHOD : string = 'method'
- METHODS : string = 'methods'
- MIN_LIMIT : string = 'minLimit'
- MIN_RANGE : string = 'min_range'
- MOCK : string = 'mock'
- MODEL : string = 'model'
- MODEL_ID : string = 'modelID'
- MODELS : string = 'models'
- NAME : string = 'name'
- NOT_EQUALS : string = 'notEquals'
- NUM : string = 'num'
- OBJECT : string = 'object'
- OFFSET : string = 'offset'
- OFFSET_DEFAULT : string = 'offset_default'
- OP : string = 'op'
- OPTIMIZED : string = 'optimized'
- OPTIONS : string = 'options'
- ORDER : string = 'order'
- OVERWRITE : string = 'overwrite'
- OWNER : string = 'owner'
- OWNER_KEY : string = 'ownerKey'
- OWNER_PATH : string = 'ownerPath'
- OWNERS : string = 'owners'
- PARAMS : string = 'params'
- PARAMS_STRATEGY : string = 'paramsStrategy'
- PASS_PHRASE : string = 'passphrase'
- PASSWORD : string = 'password'
- PATH : string = 'path'
- PATTERN : string = 'pattern'
- PDO : string = 'pdo'
- POSITION : string = 'position'
- POST_INIT : string = 'postInit'
- PRE_INIT : string = 'preInit'
- PRECISION : string = 'precision'
- PREFIX : string = 'prefix'
- PRETTY_PRINT : string = 'pretty_print'
- PROPERTIES : string = 'properties'
- PROPERTY : string = 'property'
- PROPS : string = 'props'
- QUANTITY : string = 'quantity'
- QUERY : string = 'query'
- QUERY_BUILDER : string = 'queryBuilder'
- QUERY_FIELDS : string = 'queryFields'
- QUERY_ID : string = 'queryId'
- REDIRECTS : string = 'redirects'
- RELATIONS : string = 'relations'
- RETURN : string = 'return'
- REVERSE : string = 'reverse'
- ROUTE : string = 'route'
- RULE : string = 'rule'
- RULES : string = 'rules'
- SCHEMA : string = 'schema'
- SEARCH : string = 'search'
- SIDE : string = 'side'
- SILENT : string = 'silent'
- SINGLE : string = 'single'
- SKIN : string = 'skin'
- SKIN_DEFAULT : string = 'skinDefault'
- SKIN_FROM : string = 'skinFrom'
- SKIN_METHODS : string = 'skinMethods'
- SKIN_PREFIX : string = 'skin_'
- SKINS : string = 'skins'
- SKIP : string = 'skip'
- SORT : string = 'sort'
- SORT_DEFAULT : string = 'sortDefault'
- SORTABLE : string = 'sortable'
- STATUS : string = 'status'
- STATUS_NAME : string = 'statusName'
- STRICT : string = 'strict'
- TABLE : string = 'table'
- THINGS : string = 'things'
- TIMEZONE : string = 'timezone'
- TIMEZONE_DEFAULT : string = 'timezone_default'
- TOTAL : string = 'total'
- TYPE : string = 'type'
- UNIQUE : string = 'unique'
- UPDATE : string = 'update'
- URL : string = 'url'
- USERNAME : string = 'username'
- VAL : string = 'val'
- VALIDATE : string = 'validate'
- VALIDATOR : string = 'validator'
- VALUE : string = 'value'
- VALUES : string = 'values'
- VAR_NAME : string = 'varName'
- VERBOSE : string = 'verbose'
- WITH : string = 'with'
Methods
- groupByPrefix() : array<string, mixed>
- Returns an associative array of constants whose names start with the given prefix.
Constants
ACTION
public
string
ACTION
= 'action'
ACTIONS
public
string
ACTIONS
= 'actions'
ACTIVABLE
public
string
ACTIVABLE
= 'activable'
ACTIVE
public
string
ACTIVE
= 'active'
AFTER
public
string
AFTER
= 'after'
ALIAS
public
string
ALIAS
= 'alias'
ALL
public
string
ALL
= 'all'
ALT
public
string
ALT
= 'alt'
ALTER
public
string
ALTER
= 'alter'
ALTERS
public
string
ALTERS
= 'alters'
ARGS
public
string
ARGS
= 'args'
BASE_PATH
public
string
BASE_PATH
= 'basePath'
BATCH_SIZE
public
string
BATCH_SIZE
= 'batchSize'
BEFORE
public
string
BEFORE
= 'before'
BENCH
public
string
BENCH
= 'bench'
BINDS
public
string
BINDS
= 'binds'
BOOL
public
string
BOOL
= 'bool'
CACHE
public
string
CACHE
= 'cache'
CACHEABLE
public
string
CACHEABLE
= 'cacheable'
COLLECTION
public
string
COLLECTION
= 'collection'
COMPARATOR
public
string
COMPARATOR
= 'comparator'
COMPRESS
public
string
COMPRESS
= 'compress'
CONDITION
public
string
CONDITION
= 'condition'
CONDITIONS
public
string
CONDITIONS
= 'conditions'
CONFIG
public
string
CONFIG
= 'config'
CONTEXT
public
string
CONTEXT
= 'context'
CONTROLLER
public
string
CONTROLLER
= 'controller'
CONTROLLERS
public
string
CONTROLLERS
= 'controllers'
CUSTOM_RULES
public
string
CUSTOM_RULES
= 'customRules'
DATE
public
string
DATE
= 'date'
DATE_FORMAT
public
string
DATE_FORMAT
= 'dateFormat'
DEBUG
public
string
DEBUG
= 'debug'
DEFAULT
public
string
DEFAULT
= 'default'
DEFAULT_NOT_EQUALS
public
string
DEFAULT_NOT_EQUALS
= 'defaultNotEquals'
DEFER_ASSIGNMENT
public
string
DEFER_ASSIGNMENT
= 'deferAssignment'
DEFINITION
public
string
DEFINITION
= 'definition'
DESCRIPTION
public
string
DESCRIPTION
= 'description'
DESTROY
public
string
DESTROY
= 'destroy'
DIRECTION
public
string
DIRECTION
= 'direction'
DIRECTORY
public
string
DIRECTORY
= 'directory'
DOC
public
string
DOC
= 'doc'
DOC_REF
public
string
DOC_REF
= 'docRef'
DOCS
public
string
DOCS
= 'docs'
DOCUMENT_KEY
public
string
DOCUMENT_KEY
= 'documentKey'
DOCUMENTS
public
string
DOCUMENTS
= 'documents'
ENABLE
public
string
ENABLE
= 'enable'
ENABLED
public
string
ENABLED
= 'enabled'
ENCRYPT
public
string
ENCRYPT
= 'encrypt'
EXCLUDES
public
string
EXCLUDES
= 'excludes'
EXIST
public
string
EXIST
= 'exist'
EXTENSIONS
public
string
EXTENSIONS
= 'extensions'
EXTRA_QUERY
public
string
EXTRA_QUERY
= 'extraQuery'
FACET
public
string
FACET
= 'facet'
FACETS
public
string
FACETS
= 'facets'
FIELD
public
string
FIELD
= 'field'
FIELDS
public
string
FIELDS
= 'fields'
FILE
public
string
FILE
= 'file'
FILTER
public
string
FILTER
= 'filter'
FILTER_KEYS
public
string
FILTER_KEYS
= 'filterKeys'
FILTER_PATCH_AND_PUT_KEYS
public
string
FILTER_PATCH_AND_PUT_KEYS
= 'filterPatchAndPutKeys'
FILTER_PATCH_KEYS
public
string
FILTER_PATCH_KEYS
= 'filterPatchKeys'
FILTER_POST_KEYS
public
string
FILTER_POST_KEYS
= 'filterPostKeys'
FILTER_PUT_KEYS
public
string
FILTER_PUT_KEYS
= 'filterPutKeys'
FILTERABLE
public
string
FILTERABLE
= 'filterable'
FORCE_URL
public
string
FORCE_URL
= 'forceUrl'
FORMAT
public
string
FORMAT
= 'format'
FULL_PATH
public
string
FULL_PATH
= 'fullPath'
GROUP_BY
public
string
GROUP_BY
= 'groupBy'
HARVEST
public
string
HARVEST
= 'harvest'
HAS_TOTAL
public
string
HAS_TOTAL
= 'hasTotal'
HELP
public
string
HELP
= 'help'
HTML
public
string
HTML
= 'html'
I18N
public
string
I18N
= 'i18n'
ID
public
string
ID
= 'id'
IDS
public
string
IDS
= 'ids'
INFLECTOR
public
string
INFLECTOR
= 'inflector'
INIT
public
string
INIT
= 'init'
INSERT
public
string
INSERT
= 'insert'
INTERVAL
public
string
INTERVAL
= 'interval'
INTERVAL_DEFAULT
public
string
INTERVAL_DEFAULT
= 'interval_default'
ITEMS
public
string
ITEMS
= 'items'
JOIN
public
string
JOIN
= 'join'
JOINS
public
string
JOINS
= 'joins'
JSON
public
string
JSON
= 'json'
JSON_OPTIONS
public
string
JSON_OPTIONS
= 'jsonOptions'
KEY
public
string
KEY
= 'key'
KEY_LIST
public
string
KEY_LIST
= 'keyList'
LANG
public
string
LANG
= 'lang'
LAST
public
string
LAST
= 'last'
LAZY
public
string
LAZY
= 'lazy'
LIMIT
public
string
LIMIT
= 'limit'
LIMIT_DEFAULT
public
string
LIMIT_DEFAULT
= 'limit_default'
LIST
public
string
LIST
= 'list'
LOCATION
public
string
LOCATION
= 'location'
LOCATIONS
public
string
LOCATIONS
= 'locations'
LOCKABLE
public
string
LOCKABLE
= 'lockable'
LOGGABLE
public
string
LOGGABLE
= 'loggable'
LOGGER
public
string
LOGGER
= 'logger'
MARGIN
public
string
MARGIN
= 'margin'
MATCH
public
string
MATCH
= 'match'
MAX_DEPTH
public
string
MAX_DEPTH
= 'maxDepth'
MAX_INTERVAL
public
string
MAX_INTERVAL
= 'maxInterval'
MAX_LIMIT
public
string
MAX_LIMIT
= 'maxLimit'
MAX_RANGE
public
string
MAX_RANGE
= 'max_range'
MEMCACHED
public
string
MEMCACHED
= 'memcached'
METHOD
public
string
METHOD
= 'method'
METHODS
public
string
METHODS
= 'methods'
MIN_LIMIT
public
string
MIN_LIMIT
= 'minLimit'
MIN_RANGE
public
string
MIN_RANGE
= 'min_range'
MOCK
public
string
MOCK
= 'mock'
MODEL
public
string
MODEL
= 'model'
MODEL_ID
public
string
MODEL_ID
= 'modelID'
MODELS
public
string
MODELS
= 'models'
NAME
public
string
NAME
= 'name'
NOT_EQUALS
public
string
NOT_EQUALS
= 'notEquals'
NUM
public
string
NUM
= 'num'
OBJECT
public
string
OBJECT
= 'object'
OFFSET
public
string
OFFSET
= 'offset'
OFFSET_DEFAULT
public
string
OFFSET_DEFAULT
= 'offset_default'
OP
public
string
OP
= 'op'
OPTIMIZED
public
string
OPTIMIZED
= 'optimized'
OPTIONS
public
string
OPTIONS
= 'options'
ORDER
public
string
ORDER
= 'order'
OVERWRITE
public
string
OVERWRITE
= 'overwrite'
OWNER
public
string
OWNER
= 'owner'
OWNER_KEY
public
string
OWNER_KEY
= 'ownerKey'
OWNER_PATH
public
string
OWNER_PATH
= 'ownerPath'
OWNERS
public
string
OWNERS
= 'owners'
PARAMS
public
string
PARAMS
= 'params'
PARAMS_STRATEGY
public
string
PARAMS_STRATEGY
= 'paramsStrategy'
PASS_PHRASE
public
string
PASS_PHRASE
= 'passphrase'
PASSWORD
public
string
PASSWORD
= 'password'
PATH
public
string
PATH
= 'path'
PATTERN
public
string
PATTERN
= 'pattern'
PDO
public
string
PDO
= 'pdo'
POSITION
public
string
POSITION
= 'position'
POST_INIT
public
string
POST_INIT
= 'postInit'
PRE_INIT
public
string
PRE_INIT
= 'preInit'
PRECISION
public
string
PRECISION
= 'precision'
PREFIX
public
string
PREFIX
= 'prefix'
PRETTY_PRINT
public
string
PRETTY_PRINT
= 'pretty_print'
PROPERTIES
public
string
PROPERTIES
= 'properties'
PROPERTY
public
string
PROPERTY
= 'property'
PROPS
public
string
PROPS
= 'props'
QUANTITY
public
string
QUANTITY
= 'quantity'
QUERY
public
string
QUERY
= 'query'
QUERY_BUILDER
public
string
QUERY_BUILDER
= 'queryBuilder'
QUERY_FIELDS
public
string
QUERY_FIELDS
= 'queryFields'
QUERY_ID
public
string
QUERY_ID
= 'queryId'
REDIRECTS
public
string
REDIRECTS
= 'redirects'
RELATIONS
public
string
RELATIONS
= 'relations'
RETURN
public
string
RETURN
= 'return'
REVERSE
public
string
REVERSE
= 'reverse'
ROUTE
public
string
ROUTE
= 'route'
RULE
public
string
RULE
= 'rule'
RULES
public
string
RULES
= 'rules'
SCHEMA
public
string
SCHEMA
= 'schema'
SEARCH
public
string
SEARCH
= 'search'
SIDE
public
string
SIDE
= 'side'
SILENT
public
string
SILENT
= 'silent'
SINGLE
public
string
SINGLE
= 'single'
SKIN
public
string
SKIN
= 'skin'
SKIN_DEFAULT
public
string
SKIN_DEFAULT
= 'skinDefault'
SKIN_FROM
public
string
SKIN_FROM
= 'skinFrom'
SKIN_METHODS
public
string
SKIN_METHODS
= 'skinMethods'
SKIN_PREFIX
public
string
SKIN_PREFIX
= 'skin_'
SKINS
public
string
SKINS
= 'skins'
SKIP
public
string
SKIP
= 'skip'
SORT
public
string
SORT
= 'sort'
SORT_DEFAULT
public
string
SORT_DEFAULT
= 'sortDefault'
SORTABLE
public
string
SORTABLE
= 'sortable'
STATUS
public
string
STATUS
= 'status'
STATUS_NAME
public
string
STATUS_NAME
= 'statusName'
STRICT
public
string
STRICT
= 'strict'
TABLE
public
string
TABLE
= 'table'
THINGS
public
string
THINGS
= 'things'
TIMEZONE
public
string
TIMEZONE
= 'timezone'
TIMEZONE_DEFAULT
public
string
TIMEZONE_DEFAULT
= 'timezone_default'
TOTAL
public
string
TOTAL
= 'total'
TYPE
public
string
TYPE
= 'type'
UNIQUE
public
string
UNIQUE
= 'unique'
UPDATE
public
string
UPDATE
= 'update'
URL
public
string
URL
= 'url'
USERNAME
public
string
USERNAME
= 'username'
VAL
public
string
VAL
= 'val'
VALIDATE
public
string
VALIDATE
= 'validate'
VALIDATOR
public
string
VALIDATOR
= 'validator'
VALUE
public
string
VALUE
= 'value'
VALUES
public
string
VALUES
= 'values'
VAR_NAME
public
string
VAR_NAME
= 'varName'
VERBOSE
public
string
VERBOSE
= 'verbose'
WITH
public
string
WITH
= 'with'
Methods
groupByPrefix()
Returns an associative array of constants whose names start with the given prefix.
public
static groupByPrefix(string $prefix) : array<string, mixed>
This is useful for grouping related parameters based on naming convention, such as all constants starting with "filter", "json", or "skin".
The returned array preserves constant names as keys and their corresponding values.
Example:
Param::groupByPrefix('FILTER_');
// [
// 'FILTER' => 'filter',
// 'FILTER_KEYS' => 'filterKeys',
// 'FILTER_POST_KEYS' => 'filterPostKeys',
// ...
// ]
Parameters
- $prefix : string
-
The prefix to match against constant names.
Return values
array<string, mixed> —An associative array of matching constant names and their values.