Contracts\ADR\ADRTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the ADR namespace.
This is a type registry, not a contract. It declares no members and must not be implemented; it exists only so that every shape below has a single definition, imported where it is needed with a phpstan-import-type tag naming this interface as the source.
Alias names are prefixed with adr_ because PHPStan resolves imported
type names per file and has no namespacing for them: the prefix is what
keeps generic names such as middleware_map from clashing with an alias
imported from another namespace into the same file.
Phalcon\Contracts\ADR\ADRTypes
Contracts\ADR\Action
InterfaceSource on GitHubMarker contract for a per-endpoint Action. An Action is a Handler:
__invoke(request): response.
Phalcon\Contracts\ADR\HandlerPhalcon\Contracts\ADR\Action
Contracts\ADR\Application
InterfaceSource on GitHubHandles a request end to end: routes it, dispatches the Action and returns the response, routing any error through the error responder.
Phalcon\Contracts\ADR\Application
Uses Phalcon\Contracts\Http\AttributeRequest · Phalcon\Http\ResponseInterface
Method Summary
Methods
handle()
public function handle( AttributeRequest $request ): ResponseInterface;Contracts\ADR\Dispatcher
InterfaceSource on GitHubResolves an Action by class name, builds the middleware pipeline around it and runs it to produce a response.
Phalcon\Contracts\ADR\Dispatcher
Uses Phalcon\Contracts\Http\AttributeRequest · Phalcon\Http\ResponseInterface
Method Summary
Methods
dispatch()
public function dispatch(
string $actionClass,
AttributeRequest $request,
array $routeMiddleware = []
): ResponseInterface;Contracts\ADR\Emitter\Emitter
InterfaceSource on GitHubSends a response to the client. Called by the front controller only.
Phalcon\Contracts\ADR\Emitter\Emitter
Uses Phalcon\Http\ResponseInterface
Method Summary
Methods
emit()
public function emit( ResponseInterface $response ): void;Contracts\ADR\Exceptions\ADRThrowable
InterfaceSource on GitHubBase throwable contract for the ADR component. Every ADR exception implements it, so callers can catch all ADR errors with a single type.
\ThrowablePhalcon\Contracts\ADR\Exceptions\ADRThrowable
Contracts\ADR\Handler
InterfaceSource on GitHubReceives the request and returns a response. The terminal handler in the pipeline is the Action.
Phalcon\Contracts\ADR\Handler
Uses Phalcon\Contracts\Http\AttributeRequest · Phalcon\Http\ResponseInterface
Method Summary
Methods
__invoke()
public function __invoke( AttributeRequest $request ): ResponseInterface;Contracts\ADR\Middleware
InterfaceSource on GitHubWraps the handler chain. Middleware may pass the request through to the next handler, decorate the response, short-circuit by returning its own response, or throw to route through the error responder.
Phalcon\Contracts\ADR\Middleware
Uses Phalcon\Contracts\Http\AttributeRequest · Phalcon\Http\ResponseInterface
Method Summary
Methods
__invoke()
public function __invoke(
AttributeRequest $request,
Handler $next
): ResponseInterface;Contracts\ADR\Payload\Payload
InterfaceSource on GitHubContract for the immutable payload produced by the domain layer.
Phalcon\Contracts\ADR\Payload\Payload
Uses Throwable
Method Summary
publicThrowable|nullgetException()Gets the exception thrown in the domain layer, if any.publicmixedgetExtras()Gets the arbitrary extra domain information.publicmixedgetInput()Gets the domain input.publicmixedgetMessages()Gets the domain messages.publicmixedgetResult()Gets the domain result.publicmixedgetStatus()Gets the payload status.publicPayloadwithException( Throwable$exception )Returns a copy of the payload with the given exception.publicPayloadwithExtras( mixed$extras )Returns a copy of the payload with the given extras.publicPayloadwithInput( mixed$input )Returns a copy of the payload with the given input.publicPayloadwithMessages( mixed$messages )Returns a copy of the payload with the given messages.publicPayloadwithResult( mixed$result )Returns a copy of the payload with the given result.publicPayloadwithStatus( mixed$status )Returns a copy of the payload with the given status.Methods
getException()
public function getException(): Throwable|null;Gets the exception thrown in the domain layer, if any.
getExtras()
public function getExtras(): mixed;Gets the arbitrary extra domain information.
getInput()
public function getInput(): mixed;Gets the domain input.
getMessages()
public function getMessages(): mixed;Gets the domain messages.
getResult()
public function getResult(): mixed;Gets the domain result.
getStatus()
public function getStatus(): mixed;Gets the payload status.
withException()
public function withException( Throwable $exception ): Payload;Returns a copy of the payload with the given exception.
withExtras()
public function withExtras( mixed $extras ): Payload;Returns a copy of the payload with the given extras.
withInput()
public function withInput( mixed $input ): Payload;Returns a copy of the payload with the given input.
withMessages()
public function withMessages( mixed $messages ): Payload;Returns a copy of the payload with the given messages.
withResult()
public function withResult( mixed $result ): Payload;Returns a copy of the payload with the given result.
withStatus()
public function withStatus( mixed $status ): Payload;Returns a copy of the payload with the given status.
Contracts\ADR\Responder\Formatter\Formatter
InterfaceSource on GitHubRenders a payload into a string for a given content type.
Phalcon\Contracts\ADR\Responder\Formatter\Formatter
Uses Phalcon\Contracts\ADR\Payload\Payload
Method Summary
publicboolaccepts( string$acceptHeader )Whether this formatter can satisfy the given Accept header.publicstringcontentType()The content type this formatter produces.publicstringformat( Payload$payload )Renders the payload into a string.Methods
accepts()
public function accepts( string $acceptHeader ): bool;Whether this formatter can satisfy the given Accept header.
contentType()
public function contentType(): string;The content type this formatter produces.
format()
public function format( Payload $payload ): string;Renders the payload into a string.
Contracts\ADR\Responder\Responder
InterfaceSource on GitHubTurns a payload into an HTTP response. The only layer that speaks HTTP.
Phalcon\Contracts\ADR\Responder\Responder
Uses Phalcon\Contracts\ADR\Payload\Payload · Phalcon\Http\RequestInterface · Phalcon\Http\ResponseInterface
Method Summary
publicResponseInterface__invoke(RequestInterface$request,ResponseInterface$response,Payload$payload)Methods
__invoke()
public function __invoke(
RequestInterface $request,
ResponseInterface $response,
Payload $payload
): ResponseInterface;Contracts\ADR\Router\AttributeFilter
InterfaceSource on GitHubValidates, casts and converts a router match’s positional tail segments into
named request attributes, driven by the matched Action’s optional static
params() declaration.
Phalcon\Contracts\ADR\Router\AttributeFilter
Uses Phalcon\Contracts\ADR\ADRTypes
Method Summary
Methods
filter()
public function filter(
string $actionClass,
array $attributes
): array;Contracts\ADR\Router\Router
InterfaceSource on GitHubMaps a request to an Action by convention: the HTTP method and the static path segments identify the class; trailing segments become positional request attributes. No route table.
Phalcon\Contracts\ADR\Router\Router
Uses Phalcon\Contracts\ADR\ADRTypes · Phalcon\Http\RequestInterface
Method Summary
publicarraycandidatesFor(string$method,string$path)Every Action class this router would try for the given method and path,publicstringclassFor(string$method,string$path)The class this convention names for a fully static path, derived withoutpublicRouterMatch|nullmatch( RequestInterface$request )publicstring|nullmethodFor( string$className )The HTTP method the given Action class answers, uppercased, or null whenpublicstring|nullpathFor( string$className )The canonical static path the given Action class answers, or null whenpublicRoutersetActionDirectory( string$actionDirectory )The filesystem root that backs the base namespace. The router uses it topublicRoutersetBaseNamespace( string$baseNamespace )publicRoutersetMiddlewareMap( array$middlewareMap )publicRoutersetWordSeparator( string$wordSeparator )The single delimiter between words in a path segment. AppliedMethods
candidatesFor()
public function candidatesFor(
string $method,
string $path
): array;Every Action class this router would try for the given method and path, in the order it tries them. The first that exists wins at match time. Namespace descent consults the filesystem, so the list depends on the action directory.
classFor()
public function classFor(
string $method,
string $path
): string;The class this convention names for a fully static path, derived without consulting the filesystem - the exact inverse of pathFor().
For tooling that needs the name before the code exists: generators, linters, documentation and “no action found; expected X” diagnostics. Pass the static prefix only; placeholders are the caller’s concern.
match()
public function match( RequestInterface $request ): RouterMatch|null;methodFor()
public function methodFor( string $className ): string|null;The HTTP method the given Action class answers, uppercased, or null when the class is not one this convention would have produced.
The counterpart to pathFor(): same argument, same null semantics, so a caller that accepts one answer accepts the other. Together they are the whole inverse of classFor().
pathFor()
public function pathFor( string $className ): string|null;The canonical static path the given Action class answers, or null when the class is not derivable from the base namespace. Positional attributes are not part of the canonical path.
setActionDirectory()
public function setActionDirectory( string $actionDirectory ): Router;The filesystem root that backs the base namespace. The router uses it to decide whether a path segment names a sub-namespace.
setBaseNamespace()
public function setBaseNamespace( string $baseNamespace ): Router;setMiddlewareMap()
public function setMiddlewareMap( array $middlewareMap ): Router;setWordSeparator()
public function setWordSeparator( string $wordSeparator ): Router;The single delimiter between words in a path segment. Applied symmetrically when deriving a class name from a path and a path from a class name. Any other character is literal.
Contracts\ADR\Router\RouterMatch
InterfaceSource on GitHubThe result of matching a request against the router: the Action class, the extracted route attributes, the route’s middleware and its optional name.
Phalcon\Contracts\ADR\Router\RouterMatch
Uses Phalcon\Contracts\ADR\ADRTypes
Method Summary
publicstringgetAction()publicarraygetAttributes()publicarraygetMiddleware()publicstring|nullgetName()Methods
getAction()
public function getAction(): string;getAttributes()
public function getAttributes(): array;getMiddleware()
public function getMiddleware(): array;getName()
public function getName(): string|null;Contracts\Acl\Adapter\Adapter
InterfaceSource on GitHubCanonical contract for Phalcon\Acl adapters
Phalcon\Contracts\Acl\Adapter\Adapter
Uses Phalcon\Acl\ComponentInterface · Phalcon\Acl\RoleInterface
Method Summary
publicbooladdComponent(mixed$componentValue,mixed$accessList)Adds a component to the ACL listpublicbooladdComponentAccess(string$componentName,mixed$accessList)Adds access to componentspublicbooladdInherit(string$roleName,mixed$roleToInherits)Do a role inherit from another existing rolepublicbooladdRole(mixed$role,mixed$accessInherits = null)Adds a role to the ACL list. Second parameter lets to inherit access datapublicvoidallow(string$roleName,string$componentName,mixed$access,mixed$func = null)Allow access to a role on a componentpublicvoiddeny(string$roleName,string$componentName,mixed$access,mixed$func = null)Deny access to a role on a componentpublicvoiddropComponentAccess(string$componentName,mixed$accessList)Removes access from a componentpublicnull|stringgetActiveAccess()Returns the access which the list is checking if some role can access itpublicnull|stringgetActiveComponent()Returns the component which the list is checking if some role can accesspublicnull|stringgetActiveRole()Returns the role which the list is checking if it's allowed to certainpublicComponentInterface[]getComponents()Return an array with every component registered in the listpublicintgetDefaultAction()Returns the default ACL access levelpublicarraygetInheritedRoles( string$roleName = "" )Returns the inherited roles for a passed role name. If no role namepublicintgetNoArgumentsDefaultAction()Returns the default ACL access level for no arguments provided inpublicRoleInterface[]getRoles()Return an array with every role registered in the listpublicboolisAllowed(mixed$roleName,mixed$componentName,string$access,array|null$parameters = null)Check whether a role is allowed to access an action from a componentpublicboolisComponent( string$componentName )Check whether component exist in the components listpublicboolisRole( string$roleName )Check whether role exist in the roles listpublicvoidsetDefaultAction( int$defaultAccess )Sets the default access level (Phalcon\Acl\Enum::ALLOW or Phalcon\Acl\Enum::DENY)publicvoidsetNoArgumentsDefaultAction( int$defaultAccess )Sets the default access level (Phalcon\Acl\Enum::ALLOW or Phalcon\Acl\Enum::DENY)Methods
addComponent()
public function addComponent(
mixed $componentValue,
mixed $accessList
): bool;Adds a component to the ACL list
Access names can be a particular action, by example search, update, delete, etc. or a list of them
addComponentAccess()
public function addComponentAccess(
string $componentName,
mixed $accessList
): bool;Adds access to components
addInherit()
public function addInherit(
string $roleName,
mixed $roleToInherits
): bool;Do a role inherit from another existing role
addRole()
public function addRole(
mixed $role,
mixed $accessInherits = null
): bool;Adds a role to the ACL list. Second parameter lets to inherit access data from other existing role
allow()
public function allow(
string $roleName,
string $componentName,
mixed $access,
mixed $func = null
): void;Allow access to a role on a component
deny()
public function deny(
string $roleName,
string $componentName,
mixed $access,
mixed $func = null
): void;Deny access to a role on a component
dropComponentAccess()
public function dropComponentAccess(
string $componentName,
mixed $accessList
): void;Removes access from a component
getActiveAccess()
public function getActiveAccess(): null|string;Returns the access which the list is checking if some role can access it
getActiveComponent()
public function getActiveComponent(): null|string;Returns the component which the list is checking if some role can access it
getActiveRole()
public function getActiveRole(): null|string;Returns the role which the list is checking if it’s allowed to certain component/access
getComponents()
public function getComponents(): ComponentInterface[];Return an array with every component registered in the list
getDefaultAction()
public function getDefaultAction(): int;Returns the default ACL access level
getInheritedRoles()
public function getInheritedRoles( string $roleName = "" ): array;Returns the inherited roles for a passed role name. If no role name has been specified it will return the whole array. If the role has not been found it returns an empty array
getNoArgumentsDefaultAction()
public function getNoArgumentsDefaultAction(): int;Returns the default ACL access level for no arguments provided in isAllowed action if there exists func for accessKey
getRoles()
public function getRoles(): RoleInterface[];Return an array with every role registered in the list
isAllowed()
public function isAllowed(
mixed $roleName,
mixed $componentName,
string $access,
array|null $parameters = null
): bool;Check whether a role is allowed to access an action from a component
isComponent()
public function isComponent( string $componentName ): bool;Check whether component exist in the components list
isRole()
public function isRole( string $roleName ): bool;Check whether role exist in the roles list
setDefaultAction()
public function setDefaultAction( int $defaultAccess ): void;Sets the default access level (Phalcon\Acl\Enum::ALLOW or Phalcon\Acl\Enum::DENY)
setNoArgumentsDefaultAction()
public function setNoArgumentsDefaultAction( int $defaultAccess ): void;Sets the default access level (Phalcon\Acl\Enum::ALLOW or Phalcon\Acl\Enum::DENY) for no arguments provided in isAllowed action if there exists func for accessKey
Contracts\Acl\Adapter\Persistable
InterfaceSource on GitHubContract for ACL adapters that persist their policy to a backing store as a whole-policy snapshot (coarse granularity).
NOTE: callable (closure) rules registered via allow()/deny() are NOT persisted - closures are not serializable. Re-register them in code after load(). The static rule set and role inheritance are persisted in full.
Phalcon\Contracts\Acl\Adapter\Persistable
Method Summary
publicboolload()Loads the policy snapshot from the backing store, replacing currentpublicboolsave()Persists the current policy snapshot to the backing store.Methods
load()
public function load(): bool;Loads the policy snapshot from the backing store, replacing current in-memory state. Returns false if no snapshot was found.
save()
public function save(): bool;Persists the current policy snapshot to the backing store.
Contracts\Acl\Component
InterfaceSource on GitHubCanonical contract for an ACL component entity.
Phalcon\Contracts\Acl\Component
Method Summary
publicstring__toString()Magic method __toStringpublicstring|nullgetDescription()Returns component descriptionpublicstringgetName()Returns the component nameMethods
__toString()
public function __toString(): string;Magic method __toString
getDescription()
public function getDescription(): string|null;Returns component description
getName()
public function getName(): string;Returns the component name
Contracts\Acl\ComponentAware
InterfaceSource on GitHubCanonical contract for ACL component-aware objects.
Phalcon\Contracts\Acl\ComponentAware
Method Summary
Methods
getComponentName()
public function getComponentName(): string;Returns component name
Contracts\Acl\Role
InterfaceSource on GitHubCanonical contract for an ACL role entity.
Phalcon\Contracts\Acl\Role
Method Summary
publicstring__toString()Magic method __toStringpublicstring|nullgetDescription()Returns role descriptionpublicstringgetName()Returns the role nameMethods
__toString()
public function __toString(): string;Magic method __toString
getDescription()
public function getDescription(): string|null;Returns role description
getName()
public function getName(): string;Returns the role name
Contracts\Acl\RoleAware
InterfaceSource on GitHubCanonical contract for ACL role-aware objects.
Phalcon\Contracts\Acl\RoleAware
Method Summary
Methods
getRoleName()
public function getRoleName(): string;Returns role name
Contracts\Application\ApplicationTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Application namespace.
Phalcon\Contracts\Application\ApplicationTypes
Uses Closure
Contracts\Assets\Asset
InterfaceSource on GitHubCanonical contract for Phalcon\Assets\Asset.
Covers collection membership: an asset’s key, type, HTML attributes, and filter flag. The file-output pipeline (Phalcon\Assets\Manager::output()) requires the concrete Phalcon\Assets\Asset class.
Phalcon\Contracts\Assets\Asset
Method Summary
publicstringgetAssetKey()Gets the asset's key.publicarray|nullgetAttributes()Gets extra HTML attributes.publicboolgetFilter()Gets if the asset must be filtered or not.publicstringgetType()Gets the asset's type.publicAssetsetAttributes( array$attributes )Sets extra HTML attributes.publicAssetsetFilter( bool$filter )Sets if the asset must be filtered or not.publicAssetsetType( string$type )Sets the asset's type.Methods
getAssetKey()
public function getAssetKey(): string;Gets the asset’s key.
getAttributes()
public function getAttributes(): array|null;Gets extra HTML attributes.
getFilter()
public function getFilter(): bool;Gets if the asset must be filtered or not.
getType()
public function getType(): string;Gets the asset’s type.
setAttributes()
public function setAttributes( array $attributes ): Asset;Sets extra HTML attributes.
setFilter()
public function setFilter( bool $filter ): Asset;Sets if the asset must be filtered or not.
setType()
public function setType( string $type ): Asset;Sets the asset’s type.
Contracts\Assets\Filter
InterfaceSource on GitHubCanonical contract for Phalcon\Assets filters (Cssmin, Jsmin, None, and custom user filters).
Phalcon\Contracts\Assets\Filter
Method Summary
publicstringfilter( string$content )Filters the content returning a string with the filtered contentMethods
filter()
public function filter( string $content ): string;Filters the content returning a string with the filtered content
Contracts\Auth\Access\Access
InterfaceSource on GitHubAccess gates are Specifications: policies that decide whether the current identity may run the given action. The enforcement point passes the identity (the guard) and the request context on every call; gates hold no reference to the auth manager.
Phalcon\Contracts\Auth\Access\Access
Uses Phalcon\Contracts\Auth\Guard\Guard
Method Summary
publicarraygetExceptActions()publicarraygetOnlyActions()publicboolisAllowed(Guard$guard,string$actionName,array$context = [])Whether the identity behind the guard may run the action.publicarray|nullredirectTo()publicvoidsetExceptActions( array$exceptActions = [] )Exempts the listed action names from the gate; every other action ispublicvoidsetOnlyActions( array$onlyActions = [] )Restricts the gate to the listed action names.Methods
getExceptActions()
public function getExceptActions(): array;getOnlyActions()
public function getOnlyActions(): array;isAllowed()
public function isAllowed(
Guard $guard,
string $actionName,
array $context = []
): bool;Whether the identity behind the guard may run the action.
redirectTo()
public function redirectTo(): array|null;setExceptActions()
public function setExceptActions( array $exceptActions = [] ): void;Exempts the listed action names from the gate; every other action is checked. See setOnlyActions() for the gate-family divergence note.
setOnlyActions()
public function setOnlyActions( array $onlyActions = [] ): void;Restricts the gate to the listed action names.
Authoritative semantics: the gate applies only to the listed actions; an action that is not listed passes without a check (and except() is the inverse - the gate applies to every action except those listed).
NOTE: the implementations currently diverge. The Acl gate follows the
authoritative semantics above, while the binary gates (Auth, Guest)
treat only as a whitelist - an unlisted action is denied even when the
base condition holds. The two gate families will be aligned in the next
major version; until then, choose the gate family deliberately, because
for an unlisted action they return opposite answers to the same call.
Contracts\Auth\Adapter\Adapter
InterfaceSource on GitHubAuthentication adapter contract.
Adapters look users up by credentials or by identifier and verify the
password against the stored hash. The credential payload is intentionally
unsealed: any user-row field may be used as the lookup key, plus an
optional password entry that is ignored during the row match and
consumed only by validateCredentials().
Phalcon\Contracts\Auth\Adapter\Adapter
Uses Phalcon\Contracts\Auth\AuthUser · Phalcon\Contracts\Encryption\Security\Security
Method Summary
publicstaticfromOptions(Security$hasher,array$options)Build an adapter from a flat options map. Used by ManagerFactory topublicAuthUser|nullretrieveByCredentials( array$credentials )Find a user matching the given credentials (e.g. ['email' => 'a@b']).publicAuthUser|nullretrieveById( mixed$id )Find a user by their unique identifier.publicboolvalidateCredentials(AuthUser$user,array$credentials)Validate the provided credentials against the given user.Methods
fromOptions()
public static function fromOptions(
Security $hasher,
array $options
): static;Build an adapter from a flat options map. Used by ManagerFactory to wire adapters from the application config; each implementation is free to interpret the option keys it cares about.
retrieveByCredentials()
public function retrieveByCredentials( array $credentials ): AuthUser|null;Find a user matching the given credentials (e.g. [‘email’ => ‘a@b’]). The ‘password’ key, if present, is ignored during the lookup. Returns null if no user matches.
retrieveById()
public function retrieveById( mixed $id ): AuthUser|null;Find a user by their unique identifier.
validateCredentials()
public function validateCredentials(
AuthUser $user,
array $credentials
): bool;Validate the provided credentials against the given user. Implementations typically verify the password hash held under the ‘password’ key.
Contracts\Auth\Adapter\AdapterConfig
InterfaceSource on GitHubAuthentication adapter configuration contract.
Per-adapter config shape is intentionally adapter-specific (e.g. Stream exposes getFile(), Memory exposes getUsers()); the only field shared across all adapters is the optional model class used during user hydration.
Phalcon\Contracts\Auth\Adapter\AdapterConfig
Method Summary
Methods
getModel()
public function getModel(): string|null;Returns the user-model class name to hydrate, if configured.
Contracts\Auth\Adapter\RememberAdapter
InterfaceSource on GitHubCapability extension implemented by adapters that support remember-me.
Phalcon\Contracts\Auth\Adapter\AdapterPhalcon\Contracts\Auth\Adapter\RememberAdapter
Uses Phalcon\Contracts\Auth\AuthUser · Phalcon\Contracts\Auth\RememberToken
Method Summary
publicRememberTokencreateRememberToken( AuthUser$user )Create and persist a new remember token for the user.publicAuthUser|nullretrieveByToken(mixed$id,string$token,string|null$userAgent = null)Retrieve a user by the remember-me cookie payload.Methods
createRememberToken()
public function createRememberToken( AuthUser $user ): RememberToken;Create and persist a new remember token for the user.
retrieveByToken()
public function retrieveByToken(
mixed $id,
string $token,
string|null $userAgent = null
): AuthUser|null;Retrieve a user by the remember-me cookie payload.
Contracts\Auth\AuthRemember
InterfaceSource on GitHubImplemented by authenticatable models that support remember-me tokens. This is intentionally separate from AuthUser so that adapters which do not support remember-me are not forced to implement it.
Phalcon\Contracts\Auth\AuthRemember
Method Summary
publicRememberTokencreateRememberToken(string$token,string|null$userAgent = null)Persists a new remember token for the user.publicRememberToken|nullgetRememberToken( string$token )Returns the remember token entry matching the given token value,Methods
createRememberToken()
public function createRememberToken(
string $token,
string|null $userAgent = null
): RememberToken;Persists a new remember token for the user.
getRememberToken()
public function getRememberToken( string $token ): RememberToken|null;Returns the remember token entry matching the given token value, or null if not found.
Contracts\Auth\AuthUser
InterfaceSource on GitHubImplemented by user models that can be authenticated.
Phalcon\Contracts\Auth\AuthUser
Method Summary
publicint|stringgetAuthIdentifier()Returns the unique identifier for the authenticatable userpublicstringgetAuthPassword()Returns the hashed password for the authenticatable user.Methods
getAuthIdentifier()
public function getAuthIdentifier(): int|string;Returns the unique identifier for the authenticatable user (e.g. the primary key). Implementations MUST return a non-null scalar; if a record cannot produce one, the implementation should fail at construction time rather than returning null.
getAuthPassword()
public function getAuthPassword(): string;Returns the hashed password for the authenticatable user.
Contracts\Auth\Guard\BasicAuth
InterfaceSource on GitHubPhalcon\Contracts\Auth\Guard\BasicAuth
Uses Phalcon\Contracts\Auth\AuthUser
Method Summary
publicboolbasic(string$field = "email",array$extraConditions = [])Authenticate against HTTP Basic credentials. Returns true on success.publicfalse|AuthUseronceBasic(string$field = "email",array$extraConditions = [])Like basic() but does not persist; returns the resolved user on successMethods
basic()
public function basic(
string $field = "email",
array $extraConditions = []
): bool;Authenticate against HTTP Basic credentials. Returns true on success.
onceBasic()
public function onceBasic(
string $field = "email",
array $extraConditions = []
): false|AuthUser;Like basic() but does not persist; returns the resolved user on success or false on failure.
Contracts\Auth\Guard\Guard
InterfaceSource on GitHubPhalcon\Contracts\Auth\Guard\Guard
Uses Phalcon\Contracts\Auth\Adapter\Adapter · Phalcon\Contracts\Auth\AuthUser · Phalcon\Contracts\Container\Service\Collection · Phalcon\Di\DiInterface
Method Summary
publicboolcheck()Whether the current request is authenticated.publicstaticfromOptions(Adapter$adapter,mixed$container,array$options)Build a guard from an adapter, the application container, and a flatpublicAuthUser|nullgetLastUserAttempted()Returns the last user the guard tried to authenticate during thispublicboolguest()Whether the current request is unauthenticated.publicboolhasUser()Whether the guard currently holds a resolved user.publicint|string|nullid()Returns the authenticated user's identifier, or null when nopublicstaticsetUser( AuthUser$user )Sets the current user explicitly. Returns $this for fluent chaining.publicAuthUser|nulluser()Returns the resolved user for the current request, or null.publicboolvalidate( array$credentials = [] )Validates the given credentials without logging in.Methods
check()
public function check(): bool;Whether the current request is authenticated.
fromOptions()
public static function fromOptions(
Adapter $adapter,
mixed $container,
array $options
): static;Build a guard from an adapter, the application container, and a flat options map. Used by ManagerFactory to wire guards from the application config; each implementation resolves the framework services it needs from the container.
The container is Container-first: pass a Phalcon\Container\Container. The legacy Phalcon\Di\Di is also supported with provisions - its service definitions must be pre-registered (no autowiring).
getLastUserAttempted()
public function getLastUserAttempted(): AuthUser|null;Returns the last user the guard tried to authenticate during this request, regardless of success.
guest()
public function guest(): bool;Whether the current request is unauthenticated.
hasUser()
public function hasUser(): bool;Whether the guard currently holds a resolved user.
id()
public function id(): int|string|null;Returns the authenticated user’s identifier, or null when no authenticated user is present.
setUser()
public function setUser( AuthUser $user ): static;Sets the current user explicitly. Returns $this for fluent chaining.
user()
public function user(): AuthUser|null;Returns the resolved user for the current request, or null.
validate()
public function validate( array $credentials = [] ): bool;Validates the given credentials without logging in.
Contracts\Auth\Guard\GuardConfig
InterfaceSource on GitHubAuthentication guard configuration contract.
Per-guard config shape is intentionally guard-specific (e.g. Token exposes getInputKey()/getStorageKey(); Session has no required config today). The contract carries no methods of its own - it only marks the type so AbstractGuard can accept any guard config uniformly.
Phalcon\Contracts\Auth\Guard\GuardConfig
Contracts\Auth\Guard\GuardStateful
InterfaceSource on GitHubImplemented by guards backed by persistent state (sessions/cookies).
Phalcon\Contracts\Auth\Guard\GuardStateful
Uses Phalcon\Contracts\Auth\Adapter\Adapter · Phalcon\Contracts\Auth\AuthUser
Method Summary
publicboolattempt(array$credentials = [],bool$remember = false)Attempts to authenticate the user with the given credentials and, onpublicvoidlogin(AuthUser$user,bool$remember = false)publicAuthUser|falseloginById(mixed$id,bool$remember = false)Logs in the user identified by $id. Returns the resolved user onpublicvoidlogout()publicboolviaRemember()Methods
attempt()
public function attempt(
array $credentials = [],
bool $remember = false
): bool;Attempts to authenticate the user with the given credentials and, on success, persists the resulting state on the guard.
login()
public function login(
AuthUser $user,
bool $remember = false
): void;loginById()
public function loginById(
mixed $id,
bool $remember = false
): AuthUser|false;Logs in the user identified by $id. Returns the resolved user on success or false when no user matches the id.
logout()
public function logout(): void;viaRemember()
public function viaRemember(): bool;Contracts\Auth\Manager
InterfaceSource on GitHubPhalcon\Contracts\Auth\Manager
Uses Phalcon\Auth\Exception · Phalcon\Contracts\Auth\Access\Access · Phalcon\Contracts\Auth\Adapter\Adapter · Phalcon\Contracts\Auth\Guard\Guard
Method Summary
publicselfaccess( string$accessName )Activates the named access gate for the current request and returns thepublicselfaddAccessList( array$accessList )publicselfaddGuard(string$nameGuard,Guard$guard,bool$isDefault = false)publicboolattempt(array$credentials = [],bool$remember = false)publicboolcheck()Whether the default guard reports the current request as authenticated.publicselfexcept( string$actions )Restricts the active access gate to skip the listed action names.publicAccess|nullgetAccess()Returns the active access gate, or null when none has been activated -publicarraygetAccessList()publicGuard|nullgetDefaultGuard()publicarraygetGuards()publicGuardguard( string|null$name = null )Returns the named guard, or the default guard when $name is null.publicint|string|nullid()Returns the authenticated user's identifier from the default guard,publicvoidlogout()Logs the current user out via the default guard.publicselfonly( string$actions )Restricts the active access gate to apply only to the listed action names.publicselfsetAccess( Access$access )publicselfsetDefaultGuard( Guard$guard )publicAuthUser|nulluser()Returns the resolved user from the default guard, or null.publicboolvalidate( array$credentials = [] )Validates the given credentials against the default guard withoutMethods
access()
public function access( string $accessName ): self;Activates the named access gate for the current request and returns the manager for fluent only()/except() configuration.
Enforcement is opt-in and fail-open: when no access has been activated (getAccess() returns null) every dispatch is allowed. An activated gate stays active for subsequent dispatches in the same request (forwards, nested handlers) until it is replaced. Under classic FPM this is scoped to a single request; long-running runtimes must reset it per request.
addAccessList()
public function addAccessList( array $accessList ): self;addGuard()
public function addGuard(
string $nameGuard,
Guard $guard,
bool $isDefault = false
): self;attempt()
public function attempt(
array $credentials = [],
bool $remember = false
): bool;check()
public function check(): bool;Whether the default guard reports the current request as authenticated.
except()
public function except( string $actions ): self;Restricts the active access gate to skip the listed action names.
getAccess()
public function getAccess(): Access|null;Returns the active access gate, or null when none has been activated - in which case listener enforcement is a no-op (see access()).
getAccessList()
public function getAccessList(): array;getDefaultGuard()
public function getDefaultGuard(): Guard|null;getGuards()
public function getGuards(): array;guard()
public function guard( string|null $name = null ): Guard;Returns the named guard, or the default guard when $name is null.
id()
public function id(): int|string|null;Returns the authenticated user’s identifier from the default guard, or null when no authenticated user is present.
logout()
public function logout(): void;Logs the current user out via the default guard.
only()
public function only( string $actions ): self;Restricts the active access gate to apply only to the listed action names.
setAccess()
public function setAccess( Access $access ): self;setDefaultGuard()
public function setDefaultGuard( Guard $guard ): self;user()
public function user(): AuthUser|null;Returns the resolved user from the default guard, or null.
validate()
public function validate( array $credentials = [] ): bool;Validates the given credentials against the default guard without logging in.
Contracts\Auth\RememberToken
InterfaceSource on GitHubA persisted remember-me token row.
Phalcon\Contracts\Auth\RememberToken
Method Summary
publicbooldelete()Deletes the token from storage.publicstringgetToken()Returns the token value stored for this remember entry.publicstring|nullgetUserAgent()Returns the user agent associated with this token, if any.Methods
delete()
public function delete(): bool;Deletes the token from storage.
getToken()
public function getToken(): string;Returns the token value stored for this remember entry.
getUserAgent()
public function getUserAgent(): string|null;Returns the user agent associated with this token, if any.
Contracts\Autoload\AutoloadTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Autoload namespace.
Phalcon\Contracts\Autoload\AutoloadTypes
Contracts\Cache\Cache
InterfaceSource on GitHubCanonical contract for Phalcon\Cache\Cache.
Phalcon\Contracts\Cache\Cache
Uses DateInterval · Phalcon\Cache\Exception\InvalidArgumentException
Method Summary
publicboolclear()Wipes clean the entire cache's keys.publicbooldelete( string$key )Delete an item from the cache by its unique key.publicbooldeleteMultiple( mixed$keys )Deletes multiple cache items in a single operation.publicget(string$key,mixed$defaultValue = null)Fetches a value from the cache.publicgetMultiple(mixed$keys,mixed$defaultValue = null)Obtains multiple cache items by their unique keys.publicboolhas( string$key )Determines whether an item is present in the cache.publicboolset(string$key,mixed$value,mixed$ttl = null)Persists data in the cache, uniquely referenced by a key with an optionalpublicboolsetMultiple(mixed$values,mixed$ttl = null)Persists a set of key => value pairs in the cache, with an optional TTL.Methods
clear()
public function clear(): bool;Wipes clean the entire cache’s keys.
delete()
public function delete( string $key ): bool;Delete an item from the cache by its unique key.
deleteMultiple()
public function deleteMultiple( mixed $keys ): bool;Deletes multiple cache items in a single operation.
get()
public function get(
string $key,
mixed $defaultValue = null
);Fetches a value from the cache.
getMultiple()
public function getMultiple(
mixed $keys,
mixed $defaultValue = null
);Obtains multiple cache items by their unique keys.
has()
public function has( string $key ): bool;Determines whether an item is present in the cache.
set()
public function set(
string $key,
mixed $value,
mixed $ttl = null
): bool;Persists data in the cache, uniquely referenced by a key with an optional expiration TTL time.
setMultiple()
public function setMultiple(
mixed $values,
mixed $ttl = null
): bool;Persists a set of key => value pairs in the cache, with an optional TTL.
Contracts\Cli\CliTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Cli namespace.
Phalcon\Contracts\Cli\CliTypes
Uses Phalcon\Cli\Router\Route
Contracts\Cli\Dispatcher
InterfaceSource on GitHubCanonical contract for Phalcon\Cli\Dispatcher.
Phalcon\Contracts\Dispatcher\DispatcherPhalcon\Contracts\Cli\Dispatcher
Uses Phalcon\Cli\TaskInterface · Phalcon\Contracts\Dispatcher\Dispatcher
Method Summary
publicTaskInterfacegetActiveTask()Returns the active task in the dispatcherpublicTaskInterfacegetLastTask()Returns the latest dispatched controllerpublicarraygetOptions()Get dispatched optionspublicstringgetTaskName()Gets last dispatched task namepublicstringgetTaskSuffix()Gets default task suffixpublicvoidsetDefaultTask( string$taskName )Sets the default task namepublicvoidsetOptions( array$options )Set the options to be dispatchedpublicvoidsetTaskName( string$taskName )Sets the task name to be dispatchedpublicvoidsetTaskSuffix( string$taskSuffix )Sets the default task suffixMethods
getActiveTask()
public function getActiveTask(): TaskInterface;Returns the active task in the dispatcher
getLastTask()
public function getLastTask(): TaskInterface;Returns the latest dispatched controller
getOptions()
public function getOptions(): array;Get dispatched options
getTaskName()
public function getTaskName(): string;Gets last dispatched task name
getTaskSuffix()
public function getTaskSuffix(): string;Gets default task suffix
setDefaultTask()
public function setDefaultTask( string $taskName ): void;Sets the default task name
setOptions()
public function setOptions( array $options ): void;Set the options to be dispatched
setTaskName()
public function setTaskName( string $taskName ): void;Sets the task name to be dispatched
setTaskSuffix()
public function setTaskSuffix( string $taskSuffix ): void;Sets the default task suffix
Contracts\Container\Ioc\IocContainer
InterfaceSource on GitHub[IocContainer][] affords obtaining services by name.
-
Notes:
- This interface does not afford service management. The container will need to obtain services somehow, e.g. from a [Service-Interop][] implementation.
Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary
publicobjectgetService( string$serviceName )Returns an instance of the $serviceName.publicboolhasService( string$serviceName )Is the container able to return an instance of the $serviceName?Methods
getService()
public function getService( string $serviceName ): object;Returns an instance of the $serviceName.
-
Directives:
- Implementations MUST throw [IocThrowable][] if the container
cannot return an instance of the
$serviceName.
- Implementations MUST throw [IocThrowable][] if the container
cannot return an instance of the
-
Notes:
-
The logic for this method is expressly unspecified. Retrieval may be accomplished via a service management subsystem, or by some other means.
-
The returned instance may be new or shared. The retrieval logic defines the service lifetime, not the container (per se) and not the caller requesting the service.
-
hasService()
public function hasService( string $serviceName ): bool;Is the container able to return an instance of the $serviceName?
-
Notes:
- The logic for this method is expressly unspecified. The ability check may be accomplished by querying a service management subsystem, or by some other means.
Contracts\Container\Ioc\IocContainerFactory
InterfaceSource on GitHub[IocContainerFactory][] affords obtaining a new instance of [IocContainer][].
Phalcon\Contracts\Container\Ioc\IocContainerFactory
Method Summary
Methods
newContainer()
public function newContainer(): IocContainer;Returns a new instance of [IocContainer][].
-
Notes:
- Container instantiation logic is not specified. Implementations might use providers, configuration files, attribute or annotation collection, or some other means to create and populate a container. Implementations might also choose to return a compiled or otherwise reconstituted container.
Contracts\Container\Ioc\IocThrowable
InterfaceSource on GitHub[IocThrowable][] extends [Throwable][] to mark an [Exception][] as IOC-related.
It adds no class members.
\ThrowablePhalcon\Contracts\Container\Ioc\IocThrowable
Uses Throwable
Contracts\Container\Ioc\IocTypeAliases
InterfaceSource on GitHubPhalcon\Contracts\Container\Ioc\IocTypeAliases
Contracts\Container\Resolver\ReflectionMethodResolver
InterfaceSource on GitHubPhalcon\Contracts\Container\Resolver\ReflectionMethodResolver
Uses Phalcon\Contracts\Container\Ioc\IocContainer · ReflectionMethod
Method Summary
Methods
resolveMethod()
public function resolveMethod(
IocContainer $ioc,
ReflectionMethod $method,
object $instance
): void;Contracts\Container\Resolver\ReflectionParameterResolver
InterfaceSource on GitHubPhalcon\Contracts\Container\Resolver\ReflectionParameterResolver
Uses Phalcon\Contracts\Container\Ioc\IocContainer · ReflectionParameter
Method Summary
Methods
resolveParameter()
public function resolveParameter(
IocContainer $ioc,
ReflectionParameter $parameter
): mixed;Contracts\Container\Resolver\Resolvable
InterfaceSource on GitHubPhalcon\Contracts\Container\Resolver\Resolvable
Uses Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary
Methods
resolve()
public function resolve( IocContainer $ioc ): mixed;Contracts\Container\Resolver\ResolverService
InterfaceSource on GitHubPhalcon\Contracts\Container\Resolver\ReflectionParameterResolverPhalcon\Contracts\Container\Resolver\ResolverService
Uses Phalcon\Contracts\Container\Ioc\IocContainer · ReflectionMethod · ReflectionParameter · ReflectionType
Method Summary
publicboolisResolvableClass( string$className )publicmixedresolveCall(IocContainer$ioc,callable$callableObject,array$arguments)publicobjectresolveClass(IocContainer$ioc,string$className,array$arguments)publicvoidresolveMethod(IocContainer$ioc,ReflectionMethod$method,object$instance)publicarrayresolveParameters(IocContainer$ioc,array$parameters,array$arguments)publicmixedresolveType(IocContainer$ioc,ReflectionType$type)Methods
isResolvableClass()
public function isResolvableClass( string $className ): bool;resolveCall()
public function resolveCall(
IocContainer $ioc,
callable $callableObject,
array $arguments
): mixed;resolveClass()
public function resolveClass(
IocContainer $ioc,
string $className,
array $arguments
): object;resolveMethod()
public function resolveMethod(
IocContainer $ioc,
ReflectionMethod $method,
object $instance
): void;resolveParameters()
public function resolveParameters(
IocContainer $ioc,
array $parameters,
array $arguments
): array;resolveType()
public function resolveType(
IocContainer $ioc,
ReflectionType $type
): mixed;Contracts\Container\Resolver\ResolverThrowable
InterfaceSource on GitHub\ThrowablePhalcon\Contracts\Container\Resolver\ResolverThrowable
Uses Throwable
Contracts\Container\Service\Collection
InterfaceSource on GitHubPhalcon\Contracts\Container\Ioc\IocContainerPhalcon\Contracts\Container\Service\Collection
Uses Closure · Phalcon\Container\Definition\ServiceDefinition · Phalcon\Container\Resolver\Resolver · Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary
publicServiceDefinitionbind(string$interfaceName,string$concrete)publicClosurecallableGet( string$name )publicClosurecallableNew( string$name )publicvoidextend(string$name,callable$callableObject)publicmixedget( string$name )publicstringgetAlias( string$name )publicarraygetByTag( string$tag )publicServiceDefinitiongetDefinition( string$name )publicobjectgetInstance( string$name )publicmixedgetParameter( string$name )publicResolvergetResolver()publicboolhas( string$name )publicboolhasAlias( string$name )publicboolhasDefinition( string$name )publicboolhasInstance( string$name )publicboolhasParameter( string$name )publicboolisAutowireEnabled()publicmixednew( string$name )publicServiceDefinitionnewDefinition( string$name )publicServiceDefinitionset(string$name,mixed$definition)publicstaticsetAlias(string$name,string$alias)publicstaticsetAutowire( bool$enabled )publicstaticsetDefinition(string$name,ServiceDefinition$definition)publicstaticsetInstance(string$name,object$instance,string$lifetime)publicstaticsetParameter(string$name,mixed$value)publicvoidunsetAlias( string$name )publicvoidunsetDefinition( string$name )publicvoidunsetInstance( string$name )publicvoidunsetInstances( string$lifetime )publicvoidunsetParameter( string$name )Methods
bind()
public function bind(
string $interfaceName,
string $concrete
): ServiceDefinition;callableGet()
public function callableGet( string $name ): Closure;callableNew()
public function callableNew( string $name ): Closure;extend()
public function extend(
string $name,
callable $callableObject
): void;get()
public function get( string $name ): mixed;getAlias()
public function getAlias( string $name ): string;getByTag()
public function getByTag( string $tag ): array;getDefinition()
public function getDefinition( string $name ): ServiceDefinition;getInstance()
public function getInstance( string $name ): object;getParameter()
public function getParameter( string $name ): mixed;getResolver()
public function getResolver(): Resolver;has()
public function has( string $name ): bool;hasAlias()
public function hasAlias( string $name ): bool;hasDefinition()
public function hasDefinition( string $name ): bool;hasInstance()
public function hasInstance( string $name ): bool;hasParameter()
public function hasParameter( string $name ): bool;isAutowireEnabled()
public function isAutowireEnabled(): bool;new()
public function new( string $name ): mixed;newDefinition()
public function newDefinition( string $name ): ServiceDefinition;set()
public function set(
string $name,
mixed $definition
): ServiceDefinition;setAlias()
public function setAlias(
string $name,
string $alias
): static;setAutowire()
public function setAutowire( bool $enabled ): static;setDefinition()
public function setDefinition(
string $name,
ServiceDefinition $definition
): static;setInstance()
public function setInstance(
string $name,
object $instance,
string $lifetime
): static;setParameter()
public function setParameter(
string $name,
mixed $value
): static;unsetAlias()
public function unsetAlias( string $name ): void;unsetDefinition()
public function unsetDefinition( string $name ): void;unsetInstance()
public function unsetInstance( string $name ): void;unsetInstances()
public function unsetInstances( string $lifetime ): void;unsetParameter()
public function unsetParameter( string $name ): void;Contracts\Container\Service\Definition
InterfaceSource on GitHubPhalcon\Contracts\Container\Service\Definition
Uses Phalcon\Contracts\Container\Ioc\IocContainer
Method Summary
publicstaticaddExtender( callable$extender )publicobjectbuildService( IocContainer$ioc )publicstringgetClass()publicarraygetExtenders()publiccallablegetFactory()publicstringgetLifetime()publicstringgetServiceName()publicboolhasClass()publicboolhasExtenders()publicboolhasFactory()publicstaticsetClass( string$className )publicstaticsetExtenders( array$extenders )publicstaticsetFactory( callable$factory )publicstaticsetLifetime( string$lifetime )publicstaticunsetClass()publicstaticunsetExtenders()publicstaticunsetFactory()Methods
addExtender()
public function addExtender( callable $extender ): static;buildService()
public function buildService( IocContainer $ioc ): object;getClass()
public function getClass(): string;getExtenders()
public function getExtenders(): array;getFactory()
public function getFactory(): callable;getLifetime()
public function getLifetime(): string;getServiceName()
public function getServiceName(): string;hasClass()
public function hasClass(): bool;hasExtenders()
public function hasExtenders(): bool;hasFactory()
public function hasFactory(): bool;setClass()
public function setClass( string $className ): static;setExtenders()
public function setExtenders( array $extenders ): static;setFactory()
public function setFactory( callable $factory ): static;setLifetime()
public function setLifetime( string $lifetime ): static;unsetClass()
public function unsetClass(): static;unsetExtenders()
public function unsetExtenders(): static;unsetFactory()
public function unsetFactory(): static;Contracts\Container\Service\Enumerable
InterfaceSource on GitHubOptional capability contract for a container that can report the services it
holds. Callers detect support with instanceof.
Deliberately separate from Collection rather than a member of it. Collection mirrors the service-interop surface, which has no notion of enumeration, and adding a member to a published interface breaks every implementor. A second, narrow interface states the capability without touching the first.
Carries no interop attribution because nothing here is copied: enumeration is Phalcon’s own addition.
Tooling that reports on a container type-hints this instead of the concrete Container, so it depends on a published contract rather than on an implementation detail that is free to change.
Phalcon\Contracts\Container\Service\Enumerable
Method Summary
Methods
getServiceNames()
public function getServiceNames(): array;Returns the names of every registered service definition. Names that only exist as an alias, a pre-set instance or a parameter are not included.
Contracts\Container\Service\Provider
InterfaceSource on GitHubPhalcon\Contracts\Container\Service\Provider
Method Summary
Methods
provide()
public function provide( Collection $services ): void;Contracts\Container\Service\Throwable
InterfaceSource on GitHub\ThrowablePhalcon\Contracts\Container\Service\Throwable
Uses Throwable
Contracts\Db\Adapter\Adapter
InterfaceSource on GitHubCanonical contract for Phalcon\Db adapters.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors:
- addCheck() : bool
- createMaterializedView() : bool
- dropCheck() : bool
- dropMaterializedView() : bool
- onConflictUpdate() : string
- refreshMaterializedView() : bool
- returning() : string
Phalcon\Contracts\Db\Adapter\Adapter
Uses Phalcon\Db\ColumnInterface · Phalcon\Db\DialectInterface · Phalcon\Db\IndexInterface · Phalcon\Db\RawValue · Phalcon\Db\ReferenceInterface · Phalcon\Db\ResultInterface
Method Summary
publicbooladdColumn(string$tableName,string$schemaName,ColumnInterface$column)Adds a column to a tablepublicbooladdForeignKey(string$tableName,string$schemaName,ReferenceInterface$reference)Adds a foreign key to a tablepublicbooladdIndex(string$tableName,string$schemaName,IndexInterface$index)Adds an index to a tablepublicbooladdPrimaryKey(string$tableName,string$schemaName,IndexInterface$index)Adds a primary key to a tablepublicintaffectedRows()Returns the number of affected rows by the last INSERT/UPDATE/DELETEpublicboolbegin( bool$nesting = true )Starts a transaction in the connectionpublicvoidclose()Closes active connection returning success. Phalcon automatically closespublicboolcommit( bool$nesting = true )Commits the active transaction in the connectionpublicvoidconnect( array$descriptor = [] )This method is automatically called in \Phalcon\Db\Adapter\PdopublicboolcreateSavepoint( string$name )Creates a new savepointpublicboolcreateTable(string$tableName,string$schemaName,array$definition)Creates a tablepublicboolcreateView(string$viewName,array$definition,string|null$schemaName = null)Creates a viewpublicbooldelete(mixed$table,string|null$whereCondition = null,array$placeholders = [],array$dataTypes = [])Deletes data from a table using custom RDBMS SQL syntaxpublicColumnInterface[]describeColumns(string$table,string|null$schema = null)Returns an array of Phalcon\Db\Column objects describing a tablepublicIndexInterface[]describeIndexes(string$table,string|null$schema = null)Lists table indexespublicReferenceInterface[]describeReferences(string$table,string|null$schema = null)Lists table referencespublicbooldropColumn(string$tableName,string$schemaName,string$columnName)Drops a column from a tablepublicbooldropForeignKey(string$tableName,string$schemaName,string$referenceName)Drops a foreign key from a tablepublicbooldropIndex(string$tableName,string$schemaName,string$indexName)Drop an index from a tablepublicbooldropPrimaryKey(string$tableName,string$schemaName)Drops primary key from a tablepublicbooldropTable(string$tableName,string|null$schemaName = null,bool$ifExists = true)Drops a table from a schema/databasepublicbooldropView(string$viewName,string|null$schemaName = null,bool$ifExists = true)Drops a viewpublicstringescapeIdentifier( mixed$identifier )Escapes a column/table/schema namepublicstringescapeString( string$str )Escapes a value to avoid SQL injectionspublicboolexecute(string$sqlStatement,array$bindParams = [],array$bindTypes = [])Sends SQL statements to the database server returning the success state.publicarrayfetchAll(string$sqlQuery,int$fetchMode = 2,array$bindParams = [],array$bindTypes = [])Dumps the complete result of a query into an arraypublicstring|boolfetchColumn(string$sqlQuery,array$placeholders = [],mixed$column = 0)Returns the n'th field of first row in a SQL query resultpublicarrayfetchOne(string$sqlQuery,int$fetchMode = 2,array$bindParams = [],array$bindTypes = [])Returns the first row in a SQL query resultpublicstringforUpdate(string$sqlQuery,string$modifier = "")Returns a SQL modified with a FOR UPDATE clause. The optional modifierpublicstringgetColumnDefinition( ColumnInterface$column )Returns the SQL column definition from a columnpublicstringgetColumnList( mixed$columnList )Gets a list of columnspublicintgetConnectionId()Gets the active connection unique identifierpublicRawValuegetDefaultIdValue()Return the default identity value to insert in an identity columnpublicRawValue|nullgetDefaultValue()Returns the default value to make the RBDM use the default value declaredpublicarraygetDescriptor()Return descriptor used to connect to the active databasepublicDialectInterfacegetDialect()Returns internal dialect instancepublicstringgetDialectType()Returns the name of the dialect usedpublicmixedgetInternalHandler()Return internal PDO handlerpublicstringgetNestedTransactionSavepointName()Returns the savepoint name to use for nested transactionspublicstringgetRealSQLStatement()Active SQL statement in the object without replace bound parameterspublicarraygetSQLBindTypes()Active SQL statement in the objectpublicstringgetSQLStatement()Active SQL statement in the objectpublicarraygetSQLVariables()Active SQL statement in the objectpublicstringgetType()Returns type of database system the adapter is used forpublicboolinsert(string$table,array$values,mixed$fields = null,mixed$dataTypes = null)Inserts data into a table using custom RDBMS SQL syntaxpublicboolinsertAsDict(string$table,mixed$data,mixed$dataTypes = null)Inserts data into a table using custom RBDM SQL syntaxpublicboolisNestedTransactionsWithSavepoints()Returns if nested transactions should use savepointspublicboolisUnderTransaction()Checks whether connection is under database transactionpublicstring|boollastInsertId( string|null$name = null )Returns insert id for the auto_increment column inserted in the last SQLpublicstringlimit(string$sqlQuery,mixed$number)Appends a LIMIT clause to sqlQuery argumentpublicarraylistTables( string|null$schemaName = null )List all tables on a databasepublicarraylistViews( string|null$schemaName = null )List all views on a databasepublicboolmodifyColumn(string$tableName,string$schemaName,ColumnInterface$column,ColumnInterface|null$currentColumn = null)Modifies a table column based on a definitionpublicResultInterface|boolquery(string$sqlStatement,array$bindParams = [],array$bindTypes = [])Sends SQL statements to the database server returning the success state.publicboolreleaseSavepoint( string$name )Releases given savepointpublicboolrollback( bool$nesting = true )Rollbacks the active transaction in the connectionpublicboolrollbackSavepoint( string$name )Rollbacks given savepointpublic\Phalcon\Db\Adapter\AdapterInterfacesetNestedTransactionsWithSavepoints( bool$nestedTransactionsWithSavepoints )Set if nested transactions should use savepointspublicstringsharedLock(string$sqlQuery,string$modifier = "")Returns a SQL modified with a shared-lock clause. See the dialect'spublicboolsupportSequences()Check whether the database system requires a sequence to producepublicboolsupportsDefaultValue()SQLite does not support the DEFAULT keywordpublicbooltableExists(string$tableName,string|null$schemaName = null)Generates SQL checking for the existence of a schema.tablepublicarraytableOptions(string$tableName,string|null$schemaName = null)Gets creation options from a tablepublicboolupdate(string$table,mixed$fields,mixed$values,mixed$whereCondition = null,mixed$dataTypes = null)Updates data on a table using custom RDBMS SQL syntaxpublicboolupdateAsDict(string$table,mixed$data,mixed$whereCondition = null,mixed$dataTypes = null)Updates data on a table using custom RBDM SQL syntaxpublicbooluseExplicitIdValue()Check whether the database system requires an explicit value for identitypublicboolviewExists(string$viewName,string|null$schemaName = null)Generates SQL checking for the existence of a schema.viewMethods
addColumn()
public function addColumn(
string $tableName,
string $schemaName,
ColumnInterface $column
): bool;Adds a column to a table
addForeignKey()
public function addForeignKey(
string $tableName,
string $schemaName,
ReferenceInterface $reference
): bool;Adds a foreign key to a table
addIndex()
public function addIndex(
string $tableName,
string $schemaName,
IndexInterface $index
): bool;Adds an index to a table
addPrimaryKey()
public function addPrimaryKey(
string $tableName,
string $schemaName,
IndexInterface $index
): bool;Adds a primary key to a table
affectedRows()
public function affectedRows(): int;Returns the number of affected rows by the last INSERT/UPDATE/DELETE reported by the database system
begin()
public function begin( bool $nesting = true ): bool;Starts a transaction in the connection
close()
public function close(): void;Closes active connection returning success. Phalcon automatically closes and destroys active connections within Phalcon\Db\Pool
commit()
public function commit( bool $nesting = true ): bool;Commits the active transaction in the connection
connect()
public function connect( array $descriptor = [] ): void;This method is automatically called in \Phalcon\Db\Adapter\Pdo constructor. Call it when you need to restore a database connection
createSavepoint()
public function createSavepoint( string $name ): bool;Creates a new savepoint
createTable()
public function createTable(
string $tableName,
string $schemaName,
array $definition
): bool;Creates a table
createView()
public function createView(
string $viewName,
array $definition,
string|null $schemaName = null
): bool;Creates a view
delete()
public function delete(
mixed $table,
string|null $whereCondition = null,
array $placeholders = [],
array $dataTypes = []
): bool;Deletes data from a table using custom RDBMS SQL syntax
describeColumns()
public function describeColumns(
string $table,
string|null $schema = null
): ColumnInterface[];Returns an array of Phalcon\Db\Column objects describing a table
describeIndexes()
public function describeIndexes(
string $table,
string|null $schema = null
): IndexInterface[];Lists table indexes
describeReferences()
public function describeReferences(
string $table,
string|null $schema = null
): ReferenceInterface[];Lists table references
dropColumn()
public function dropColumn(
string $tableName,
string $schemaName,
string $columnName
): bool;Drops a column from a table
dropForeignKey()
public function dropForeignKey(
string $tableName,
string $schemaName,
string $referenceName
): bool;Drops a foreign key from a table
dropIndex()
public function dropIndex(
string $tableName,
string $schemaName,
string $indexName
): bool;Drop an index from a table
dropPrimaryKey()
public function dropPrimaryKey(
string $tableName,
string $schemaName
): bool;Drops primary key from a table
dropTable()
public function dropTable(
string $tableName,
string|null $schemaName = null,
bool $ifExists = true
): bool;Drops a table from a schema/database
dropView()
public function dropView(
string $viewName,
string|null $schemaName = null,
bool $ifExists = true
): bool;Drops a view
escapeIdentifier()
public function escapeIdentifier( mixed $identifier ): string;Escapes a column/table/schema name
escapeString()
public function escapeString( string $str ): string;Escapes a value to avoid SQL injections
execute()
public function execute(
string $sqlStatement,
array $bindParams = [],
array $bindTypes = []
): bool;Sends SQL statements to the database server returning the success state. Use this method only when the SQL statement sent to the server does not return any rows
fetchAll()
public function fetchAll(
string $sqlQuery,
int $fetchMode = 2,
array $bindParams = [],
array $bindTypes = []
): array;Dumps the complete result of a query into an array
fetchColumn()
public function fetchColumn(
string $sqlQuery,
array $placeholders = [],
mixed $column = 0
): string|bool;Returns the n’th field of first row in a SQL query result
// Getting count of invoices
$invoicesCount = $connection->fetchColumn("SELECT COUNT(*) FROM co_invoices");
print_r($invoicesCount);
// Getting the title of the last created invoice
$invoice = $connection->fetchColumn(
"SELECT inv_id, inv_title FROM co_invoices ORDER BY inv_created_at DESC",
1
);
print_r($invoice);fetchOne()
public function fetchOne(
string $sqlQuery,
int $fetchMode = 2,
array $bindParams = [],
array $bindTypes = []
): array;Returns the first row in a SQL query result
forUpdate()
public function forUpdate(
string $sqlQuery,
string $modifier = ""
): string;Returns a SQL modified with a FOR UPDATE clause. The optional modifier
appends a row-lock disposition keyword - pass Dialect::LOCK_NOWAIT
or Dialect::LOCK_SKIP_LOCKED (or leave as Dialect::LOCK_NONE).
getColumnDefinition()
public function getColumnDefinition( ColumnInterface $column ): string;Returns the SQL column definition from a column
getColumnList()
public function getColumnList( mixed $columnList ): string;Gets a list of columns
getConnectionId()
public function getConnectionId(): int;Gets the active connection unique identifier
getDefaultIdValue()
public function getDefaultIdValue(): RawValue;Return the default identity value to insert in an identity column
getDefaultValue()
public function getDefaultValue(): RawValue|null;Returns the default value to make the RBDM use the default value declared in the table definition
// Inserting a new invoice with a valid default value for the column 'inv_total'
$success = $connection->insert(
"co_invoices",
[
"Test Invoice",
$connection->getDefaultValue()
],
[
"inv_title",
"inv_total",
]
);@todo Return NULL if this is not supported by the adapter
getDescriptor()
public function getDescriptor(): array;Return descriptor used to connect to the active database
getDialect()
public function getDialect(): DialectInterface;Returns internal dialect instance
getDialectType()
public function getDialectType(): string;Returns the name of the dialect used
getInternalHandler()
public function getInternalHandler(): mixed;Return internal PDO handler
getNestedTransactionSavepointName()
public function getNestedTransactionSavepointName(): string;Returns the savepoint name to use for nested transactions
getRealSQLStatement()
public function getRealSQLStatement(): string;Active SQL statement in the object without replace bound parameters
getSQLBindTypes()
public function getSQLBindTypes(): array;Active SQL statement in the object
getSQLStatement()
public function getSQLStatement(): string;Active SQL statement in the object
getSQLVariables()
public function getSQLVariables(): array;Active SQL statement in the object
getType()
public function getType(): string;Returns type of database system the adapter is used for
insert()
public function insert(
string $table,
array $values,
mixed $fields = null,
mixed $dataTypes = null
): bool;Inserts data into a table using custom RDBMS SQL syntax
insertAsDict()
public function insertAsDict(
string $table,
mixed $data,
mixed $dataTypes = null
): bool;Inserts data into a table using custom RBDM SQL syntax
// Inserting a new invoice
$success = $connection->insertAsDict(
"co_invoices",
[
"inv_title" => "Test Invoice",
"inv_total" => 100,
]
);
// Next SQL sentence is sent to the database system
INSERT INTO `co_invoices` (`inv_title`, `inv_total`) VALUES ("Test Invoice", 100);isNestedTransactionsWithSavepoints()
public function isNestedTransactionsWithSavepoints(): bool;Returns if nested transactions should use savepoints
isUnderTransaction()
public function isUnderTransaction(): bool;Checks whether connection is under database transaction
lastInsertId()
public function lastInsertId( string|null $name = null ): string|bool;Returns insert id for the auto_increment column inserted in the last SQL statement
limit()
public function limit(
string $sqlQuery,
mixed $number
): string;Appends a LIMIT clause to sqlQuery argument
listTables()
public function listTables( string|null $schemaName = null ): array;List all tables on a database
listViews()
public function listViews( string|null $schemaName = null ): array;List all views on a database
modifyColumn()
public function modifyColumn(
string $tableName,
string $schemaName,
ColumnInterface $column,
ColumnInterface|null $currentColumn = null
): bool;Modifies a table column based on a definition
query()
public function query(
string $sqlStatement,
array $bindParams = [],
array $bindTypes = []
): ResultInterface|bool;Sends SQL statements to the database server returning the success state. Use this method only when the SQL statement sent to the server returns rows
releaseSavepoint()
public function releaseSavepoint( string $name ): bool;Releases given savepoint
rollback()
public function rollback( bool $nesting = true ): bool;Rollbacks the active transaction in the connection
rollbackSavepoint()
public function rollbackSavepoint( string $name ): bool;Rollbacks given savepoint
setNestedTransactionsWithSavepoints()
public function setNestedTransactionsWithSavepoints( bool $nestedTransactionsWithSavepoints ): \Phalcon\Db\Adapter\AdapterInterface;Set if nested transactions should use savepoints
sharedLock()
public function sharedLock(
string $sqlQuery,
string $modifier = ""
): string;Returns a SQL modified with a shared-lock clause. See the dialect’s
sharedLock() for per-engine semantics. The optional modifier is
passed straight through (use Dialect::LOCK_NOWAIT /
Dialect::LOCK_SKIP_LOCKED for PostgreSQL).
supportSequences()
public function supportSequences(): bool;Check whether the database system requires a sequence to produce auto-numeric values
supportsDefaultValue()
public function supportsDefaultValue(): bool;SQLite does not support the DEFAULT keyword
tableExists()
public function tableExists(
string $tableName,
string|null $schemaName = null
): bool;Generates SQL checking for the existence of a schema.table
tableOptions()
public function tableOptions(
string $tableName,
string|null $schemaName = null
): array;Gets creation options from a table
update()
public function update(
string $table,
mixed $fields,
mixed $values,
mixed $whereCondition = null,
mixed $dataTypes = null
): bool;Updates data on a table using custom RDBMS SQL syntax
updateAsDict()
public function updateAsDict(
string $table,
mixed $data,
mixed $whereCondition = null,
mixed $dataTypes = null
): bool;Updates data on a table using custom RBDM SQL syntax Another, more convenient syntax
// Updating existing invoice
$success = $connection->updateAsDict(
"co_invoices",
[
"inv_title" => "New Test Invoice",
],
"inv_id = 101"
);
// Next SQL sentence is sent to the database system
UPDATE `co_invoices` SET `inv_title` = "New Test Invoice" WHERE inv_id = 101useExplicitIdValue()
public function useExplicitIdValue(): bool;Check whether the database system requires an explicit value for identity columns
viewExists()
public function viewExists(
string $viewName,
string|null $schemaName = null
): bool;Generates SQL checking for the existence of a schema.view
Contracts\Db\Check
InterfaceSource on GitHubCanonical contract for Phalcon\Db\Check.
Phalcon\Contracts\Db\Check
Method Summary
publicstringgetExpression()Gets the CHECK expression (the SQL boolean predicate).publicstringgetName()Gets the constraint name. An empty string indicates an unnamed CHECKMethods
getExpression()
public function getExpression(): string;Gets the CHECK expression (the SQL boolean predicate).
getName()
public function getName(): string;Gets the constraint name. An empty string indicates an unnamed CHECK
constraint - the dialect will emit the clause without a CONSTRAINT
prefix in that case.
Contracts\Db\Column
InterfaceSource on GitHubCanonical contract for Phalcon\Db\Column.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors:
- getGenerationExpression() : string | null
- isArray() : bool
- isGenerated() : bool
- isGenerationStored() : bool
- isInvisible() : bool
Phalcon\Contracts\Db\Column
Method Summary
publicstring|nullgetAfterPosition()Check whether field absolute to position in tablepublicintgetBindType()Returns the type of bind handlingpublicmixedgetDefault()Returns default value of columnpublicstringgetName()Returns column namepublicintgetScale()Returns column scalepublicint|stringgetSize()Returns column sizepublicint|stringgetType()Returns column typepublicintgetTypeReference()Returns column type referencepublicarray|string|intgetTypeValues()Returns column type valuespublicboolhasDefault()Check whether column has default valuepublicboolisAutoIncrement()Auto-IncrementpublicboolisFirst()Check whether column have first position in tablepublicboolisNotNull()Not nullpublicboolisNumeric()Check whether column have an numeric typepublicboolisPrimary()Column is part of the primary key?publicboolisUnsigned()Returns true if number column is unsignedMethods
getAfterPosition()
public function getAfterPosition(): string|null;Check whether field absolute to position in table
getBindType()
public function getBindType(): int;Returns the type of bind handling
getDefault()
public function getDefault(): mixed;Returns default value of column
getName()
public function getName(): string;Returns column name
getScale()
public function getScale(): int;Returns column scale
getSize()
public function getSize(): int|string;Returns column size
getType()
public function getType(): int|string;Returns column type
getTypeReference()
public function getTypeReference(): int;Returns column type reference
getTypeValues()
public function getTypeValues(): array|string|int;Returns column type values
hasDefault()
public function hasDefault(): bool;Check whether column has default value
isAutoIncrement()
public function isAutoIncrement(): bool;Auto-Increment
isFirst()
public function isFirst(): bool;Check whether column have first position in table
isNotNull()
public function isNotNull(): bool;Not null
isNumeric()
public function isNumeric(): bool;Check whether column have an numeric type
isPrimary()
public function isPrimary(): bool;Column is part of the primary key?
isUnsigned()
public function isUnsigned(): bool;Returns true if number column is unsigned
Contracts\Db\Dialect
InterfaceSource on GitHubCanonical contract for Phalcon\Db dialects.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors:
- addCheck() : string
- createMaterializedView() : string
- dropCheck() : string
- dropMaterializedView() : string
- onConflictUpdate() : string
- refreshMaterializedView() : string
- returning() : string
Phalcon\Contracts\Db\Dialect
Uses Phalcon\Db\ColumnInterface · Phalcon\Db\IndexInterface · Phalcon\Db\ReferenceInterface
Method Summary
publicstringaddColumn(string$tableName,string$schemaName,ColumnInterface$column)Generates SQL to add a column to a tablepublicstringaddForeignKey(string$tableName,string$schemaName,ReferenceInterface$reference)Generates SQL to add an index to a tablepublicstringaddIndex(string$tableName,string$schemaName,IndexInterface$index)Generates SQL to add an index to a tablepublicstringaddPrimaryKey(string$tableName,string$schemaName,IndexInterface$index)Generates SQL to add the primary key to a tablepublicstringcreateSavepoint( string$name )Generate SQL to create a new savepointpublicstringcreateTable(string$tableName,string$schemaName,array$definition)Generates SQL to create a tablepublicstringcreateView(string$viewName,array$definition,string|null$schemaName = null)Generates SQL to create a viewpublicstringdescribeColumns(string$table,string|null$schema = null)Generates SQL to describe a tablepublicstringdescribeIndexes(string$table,string|null$schema = null)Generates SQL to query indexes on a table.publicstringdescribeReferences(string$table,string|null$schema = null)Generates SQL to query foreign keys on a table.publicstringdropColumn(string$tableName,string$schemaName,string$columnName)Generates SQL to delete a column from a tablepublicstringdropForeignKey(string$tableName,string$schemaName,string$referenceName)Generates SQL to delete a foreign key from a tablepublicstringdropIndex(string$tableName,string$schemaName,string$indexName)Generates SQL to delete an index from a tablepublicstringdropPrimaryKey(string$tableName,string$schemaName)Generates SQL to delete primary key from a tablepublicstringdropTable(string$tableName,string$schemaName,bool$ifExists = true)Generates SQL to drop a tablepublicstringdropView(string$viewName,string|null$schemaName = null,bool$ifExists = true)Generates SQL to drop a viewpublicstringforUpdate(string$sqlQuery,string$modifier = "")Returns a SQL modified with a FOR UPDATE clause. The optional modifierpublicstringgetColumnDefinition( ColumnInterface$column )Gets the column name in RDBMSpublicstringgetColumnList( array$columnList )Gets a list of columnspublicarraygetCustomFunctions()Returns registered functionspublicstringgetSqlExpression(array$expression,string|null$escapeChar = null,array$bindCounts = [])Transforms an intermediate representation for an expression into apublicstringlimit(string$sqlQuery,mixed$number)Generates the SQL for LIMIT clausepublicstringlistTables( string|null$schemaName = null )List all tables in databasepublicstringmodifyColumn(string$tableName,string$schemaName,ColumnInterface$column,ColumnInterface|null$currentColumn = null)Generates SQL to modify a column in a tablepublic\Phalcon\Db\DialectregisterCustomFunction(string$name,callable$customFunction)Registers custom SQL functionspublicstringreleaseSavepoint( string$name )Generate SQL to release a savepointpublicstringrollbackSavepoint( string$name )Generate SQL to rollback a savepointpublicstringselect( array$definition )Builds a SELECT statementpublicstringsharedLock(string$sqlQuery,string$modifier = "")Returns a SQL modified with a shared-lock clause. MySQL emitspublicboolsupportsReleaseSavepoints()Checks whether the platform supports releasing savepoints.publicboolsupportsSavepoints()Checks whether the platform supports savepointspublicstringtableExists(string$tableName,string|null$schemaName = null)Generates SQL checking for the existence of a schema.tablepublicstringtableOptions(string$table,string|null$schema = null)Generates the SQL to describe the table creation optionspublicstringviewExists(string$viewName,string|null$schemaName = null)Generates SQL checking for the existence of a schema.viewConstants
stringLOCK_NONE = ""No row-lock modifier - the default behavior for forUpdate().stringLOCK_NOWAIT = "NOWAIT"Append NOWAIT to the FOR UPDATE clause - the query fails immediately if a row it needs is locked instead of blocking. MySQL 8.0+ and PostgreSQL 9.5+ recognize this. SQLite has no row-level locking and silently ignores the modifier.stringLOCK_SKIP_LOCKED = "SKIP LOCKED"Append SKIP LOCKED to the FOR UPDATE clause - the query returns rows that are not currently locked and silently skips ones that are. MySQL 8.0+ and PostgreSQL 9.5+ recognize this. SQLite ignores it.Methods
addColumn()
public function addColumn(
string $tableName,
string $schemaName,
ColumnInterface $column
): string;Generates SQL to add a column to a table
addForeignKey()
public function addForeignKey(
string $tableName,
string $schemaName,
ReferenceInterface $reference
): string;Generates SQL to add an index to a table
addIndex()
public function addIndex(
string $tableName,
string $schemaName,
IndexInterface $index
): string;Generates SQL to add an index to a table
addPrimaryKey()
public function addPrimaryKey(
string $tableName,
string $schemaName,
IndexInterface $index
): string;Generates SQL to add the primary key to a table
createSavepoint()
public function createSavepoint( string $name ): string;Generate SQL to create a new savepoint
createTable()
public function createTable(
string $tableName,
string $schemaName,
array $definition
): string;Generates SQL to create a table
createView()
public function createView(
string $viewName,
array $definition,
string|null $schemaName = null
): string;Generates SQL to create a view
describeColumns()
public function describeColumns(
string $table,
string|null $schema = null
): string;Generates SQL to describe a table
describeIndexes()
public function describeIndexes(
string $table,
string|null $schema = null
): string;Generates SQL to query indexes on a table.
The base adapter consumes the result as FETCH_NUM rows by position:
column index 2 must be the index key name and column index 4 the indexed
column name.
describeReferences()
public function describeReferences(
string $table,
string|null $schema = null
): string;Generates SQL to query foreign keys on a table.
The base adapter consumes the result as FETCH_NUM rows by position:
index 1 the local column, index 2 the constraint name, index 3 the
referenced schema, index 4 the referenced table, and index 5 the
referenced column.
dropColumn()
public function dropColumn(
string $tableName,
string $schemaName,
string $columnName
): string;Generates SQL to delete a column from a table
dropForeignKey()
public function dropForeignKey(
string $tableName,
string $schemaName,
string $referenceName
): string;Generates SQL to delete a foreign key from a table
dropIndex()
public function dropIndex(
string $tableName,
string $schemaName,
string $indexName
): string;Generates SQL to delete an index from a table
dropPrimaryKey()
public function dropPrimaryKey(
string $tableName,
string $schemaName
): string;Generates SQL to delete primary key from a table
dropTable()
public function dropTable(
string $tableName,
string $schemaName,
bool $ifExists = true
): string;Generates SQL to drop a table
dropView()
public function dropView(
string $viewName,
string|null $schemaName = null,
bool $ifExists = true
): string;Generates SQL to drop a view
forUpdate()
public function forUpdate(
string $sqlQuery,
string $modifier = ""
): string;Returns a SQL modified with a FOR UPDATE clause. The optional modifier
appends a row-lock disposition keyword - pass Dialect::LOCK_NOWAIT
or Dialect::LOCK_SKIP_LOCKED (or leave as Dialect::LOCK_NONE).
getColumnDefinition()
public function getColumnDefinition( ColumnInterface $column ): string;Gets the column name in RDBMS
getColumnList()
public function getColumnList( array $columnList ): string;Gets a list of columns
getCustomFunctions()
public function getCustomFunctions(): array;Returns registered functions
getSqlExpression()
public function getSqlExpression(
array $expression,
string|null $escapeChar = null,
array $bindCounts = []
): string;Transforms an intermediate representation for an expression into a database system valid expression
limit()
public function limit(
string $sqlQuery,
mixed $number
): string;Generates the SQL for LIMIT clause
listTables()
public function listTables( string|null $schemaName = null ): string;List all tables in database
modifyColumn()
public function modifyColumn(
string $tableName,
string $schemaName,
ColumnInterface $column,
ColumnInterface|null $currentColumn = null
): string;Generates SQL to modify a column in a table
registerCustomFunction()
public function registerCustomFunction(
string $name,
callable $customFunction
): \Phalcon\Db\Dialect;Registers custom SQL functions
releaseSavepoint()
public function releaseSavepoint( string $name ): string;Generate SQL to release a savepoint
rollbackSavepoint()
public function rollbackSavepoint( string $name ): string;Generate SQL to rollback a savepoint
select()
public function select( array $definition ): string;Builds a SELECT statement
sharedLock()
public function sharedLock(
string $sqlQuery,
string $modifier = ""
): string;Returns a SQL modified with a shared-lock clause. MySQL emits
LOCK IN SHARE MODE; PostgreSQL emits FOR SHARE; SQLite returns the
original query unchanged. The optional modifier appends a row-lock
disposition keyword (Dialect::LOCK_NOWAIT / Dialect::LOCK_SKIP_LOCKED)
for PostgreSQL - MySQL’s legacy LOCK IN SHARE MODE does not support
modifiers, so non-empty values are silently ignored on MySQL.
supportsReleaseSavepoints()
public function supportsReleaseSavepoints(): bool;Checks whether the platform supports releasing savepoints.
supportsSavepoints()
public function supportsSavepoints(): bool;Checks whether the platform supports savepoints
tableExists()
public function tableExists(
string $tableName,
string|null $schemaName = null
): string;Generates SQL checking for the existence of a schema.table
tableOptions()
public function tableOptions(
string $table,
string|null $schema = null
): string;Generates the SQL to describe the table creation options
viewExists()
public function viewExists(
string $viewName,
string|null $schemaName = null
): string;Generates SQL checking for the existence of a schema.view
Contracts\Db\Geometry\Geometry
InterfaceSource on GitHubCanonical contract for Phalcon\Db\Geometry value objects.
Phalcon\Contracts\Db\Geometry\Geometry
Method Summary
publicintgetSrid()Gets the Spatial Reference System Identifier (SRID).publicintgetType()Gets the geometry type.publicstringtoWkt()Renders the geometry as a Well-Known Text (WKT) string.Methods
getSrid()
public function getSrid(): int;Gets the Spatial Reference System Identifier (SRID).
getType()
public function getType(): int;Gets the geometry type.
toWkt()
public function toWkt(): string;Renders the geometry as a Well-Known Text (WKT) string.
Contracts\Db\Index
InterfaceSource on GitHubCanonical contract for Phalcon\Db\Index.
@todo v7 - these will become required interface members. They are omitted from the v5 line to avoid breaking third-party implementors:
- getDirections() : array
- getWhere() : string
- isConcurrent() : bool
- isInvisible() : bool
Phalcon\Contracts\Db\Index
Method Summary
publicarraygetColumns()Gets the columns that corresponds the indexpublicstringgetName()Gets the index namepublicstringgetType()Gets the index typeMethods
getColumns()
public function getColumns(): array;Gets the columns that corresponds the index
getName()
public function getName(): string;Gets the index name
getType()
public function getType(): string;Gets the index type
Contracts\Db\Reference
InterfaceSource on GitHubCanonical contract for Phalcon\Db\Reference.
Phalcon\Contracts\Db\Reference
Method Summary
publicarraygetColumns()Gets local columns which reference is basedpublicstringgetName()Gets the index namepublicstring|nullgetOnDelete()Gets the referenced on deletepublicstring|nullgetOnUpdate()Gets the referenced on updatepublicarraygetReferencedColumns()Gets referenced columnspublicstring|nullgetReferencedSchema()Gets the schema where referenced table ispublicstringgetReferencedTable()Gets the referenced tablepublicstring|nullgetSchemaName()Gets the schema where referenced table isMethods
getColumns()
public function getColumns(): array;Gets local columns which reference is based
getName()
public function getName(): string;Gets the index name
getOnDelete()
public function getOnDelete(): string|null;Gets the referenced on delete
getOnUpdate()
public function getOnUpdate(): string|null;Gets the referenced on update
getReferencedColumns()
public function getReferencedColumns(): array;Gets referenced columns
getReferencedSchema()
public function getReferencedSchema(): string|null;Gets the schema where referenced table is
getReferencedTable()
public function getReferencedTable(): string;Gets the referenced table
getSchemaName()
public function getSchemaName(): string|null;Gets the schema where referenced table is
Contracts\Db\Result
InterfaceSource on GitHubCanonical contract for Phalcon\Db result objects.
Phalcon\Contracts\Db\Result
Method Summary
publicdataSeek( int$number )Moves internal resultset cursor to another position letting us to fetch apublicboolexecute()Allows to execute the statement again. Some database systems don'tpublicmixedfetch()Fetches an array/object of strings that corresponds to the fetched row,publicarrayfetchAll()Returns an array of arrays containing all the records in the result. ThispublicmixedfetchArray()Returns an array of strings that corresponds to the fetched row, or FALSEpublic\PDOStatementgetInternalResult()Gets the internal PDO result objectpublicintnumRows()Gets number of rows returned by a resultsetpublicboolsetFetchMode( int$fetchMode )Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()Methods
dataSeek()
public function dataSeek( int $number );Moves internal resultset cursor to another position letting us to fetch a certain row
execute()
public function execute(): bool;Allows to execute the statement again. Some database systems don’t support scrollable cursors. So, as cursors are forward only, we need to execute the cursor again to fetch rows from the beginning
fetch()
public function fetch(): mixed;Fetches an array/object of strings that corresponds to the fetched row,
or FALSE if there are no more rows. This method is affected by the active
fetch flag set using Phalcon\Db\Result\Pdo::setFetchMode()
fetchAll()
public function fetchAll(): array;Returns an array of arrays containing all the records in the result. This
method is affected by the active fetch flag set using
Phalcon\Db\Result\Pdo::setFetchMode()
fetchArray()
public function fetchArray(): mixed;Returns an array of strings that corresponds to the fetched row, or FALSE
if there are no more rows. This method is affected by the active fetch
flag set using Phalcon\Db\Result\Pdo::setFetchMode()
getInternalResult()
public function getInternalResult(): \PDOStatement;Gets the internal PDO result object
numRows()
public function numRows(): int;Gets number of rows returned by a resultset
setFetchMode()
public function setFetchMode( int $fetchMode ): bool;Changes the fetching mode affecting Phalcon\Db\Result\Pdo::fetch()
Contracts\Dispatcher\Dispatcher
InterfaceSource on GitHubCanonical contract for Phalcon\Dispatcher\AbstractDispatcher.
Note: The deprecated getParam()/getParams()/hasParam()/setParam()/
setParams() spellings are still declared for backwards compatibility and
are scheduled to be removed in the next major version in favor of their
*Parameter counterparts.
Phalcon\Contracts\Dispatcher\Dispatcher
Method Summary
publicmixed|booldispatch()Dispatches a handle action taking into account the routing parameterspublicvoidforward( array$forward )Forwards the execution flow to another controller/actionpublicstringgetActionName()Gets last dispatched action namepublicstringgetActionSuffix()Gets the default action suffixpublicstringgetHandlerSuffix()Gets the default handler suffixpublicmixedgetParam(mixed$param,mixed$filters = null)Gets a param by its name or numeric indexpublicmixedgetParameter(mixed$param,mixed$filters = null)Gets a param by its name or numeric indexpublicarraygetParameters()Gets action paramspublicarraygetParams()Gets action paramspublicmixedgetReturnedValue()Returns value returned by the latest dispatched actionpublicboolhasParam( mixed$param )Check if a param existspublicboolisFinished()Checks if the dispatch loop is finished or has more pendentpublicvoidsetActionName( string$actionName )Sets the action name to be dispatchedpublicvoidsetActionSuffix( string$actionSuffix )Sets the default action suffixpublicvoidsetDefaultAction( string$actionName )Sets the default action namepublicvoidsetDefaultNamespace( string$defaultNamespace )Sets the default namespacepublicvoidsetHandlerSuffix( string$handlerSuffix )Sets the default suffix for the handlerpublicvoidsetModuleName( string|null$moduleName = null )Sets the module name which the application belongs topublicvoidsetNamespaceName( string$namespaceName )Sets the namespace which the controller belongs topublicvoidsetParam(mixed$param,mixed$value)Set a param by its name or numeric indexpublicvoidsetParams( array$params )Sets action params to be dispatchedMethods
dispatch()
public function dispatch(): mixed|bool;Dispatches a handle action taking into account the routing parameters
forward()
public function forward( array $forward ): void;Forwards the execution flow to another controller/action
getActionName()
public function getActionName(): string;Gets last dispatched action name
getActionSuffix()
public function getActionSuffix(): string;Gets the default action suffix
getHandlerSuffix()
public function getHandlerSuffix(): string;Gets the default handler suffix
getParam()
public function getParam(
mixed $param,
mixed $filters = null
): mixed;Gets a param by its name or numeric index
Note: This signature omits the defaultValue argument the implementation
accepts; the two will be aligned in the next major version.
getParameter()
public function getParameter(
mixed $param,
mixed $filters = null
): mixed;Gets a param by its name or numeric index
getParameters()
public function getParameters(): array;Gets action params
getParams()
public function getParams(): array;Gets action params
getReturnedValue()
public function getReturnedValue(): mixed;Returns value returned by the latest dispatched action
hasParam()
public function hasParam( mixed $param ): bool;Check if a param exists
isFinished()
public function isFinished(): bool;Checks if the dispatch loop is finished or has more pendent controllers/tasks to dispatch
setActionName()
public function setActionName( string $actionName ): void;Sets the action name to be dispatched
setActionSuffix()
public function setActionSuffix( string $actionSuffix ): void;Sets the default action suffix
setDefaultAction()
public function setDefaultAction( string $actionName ): void;Sets the default action name
setDefaultNamespace()
public function setDefaultNamespace( string $defaultNamespace ): void;Sets the default namespace
setHandlerSuffix()
public function setHandlerSuffix( string $handlerSuffix ): void;Sets the default suffix for the handler
setModuleName()
public function setModuleName( string|null $moduleName = null ): void;Sets the module name which the application belongs to
setNamespaceName()
public function setNamespaceName( string $namespaceName ): void;Sets the namespace which the controller belongs to
setParam()
public function setParam(
mixed $param,
mixed $value
): void;Set a param by its name or numeric index
setParams()
public function setParams( array $params ): void;Sets action params to be dispatched
Contracts\Dispatcher\DispatcherTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Dispatcher namespace.
Phalcon\Contracts\Dispatcher\DispatcherTypes
Contracts\Domain\Payload\Payload
InterfaceSource on GitHubCanonical combined read/write contract for a domain payload.
Payload extends both Writeable and Readable, exposing the full
capability set. The intended convention narrows that surface by which side of
the Action-Domain-Responder boundary holds the payload: the domain layer
builds the payload through Writeable (the setters), while the responder
consumes the finished payload through Readable (the getters). Type-hinting
against the narrower contract at each boundary keeps each side to the
capability it needs, even though the concrete payload implements both.
@see Readable @see Writeable
Phalcon\Contracts\Domain\Payload\ReadablePhalcon\Contracts\Domain\Payload\Payload- extendsPhalcon\Contracts\Domain\Payload\Readable,Phalcon\Contracts\Domain\Payload\Writeable
Contracts\Domain\Payload\Readable
InterfaceSource on GitHubCanonical read-only contract for a domain payload.
Responders consume a finished payload through this contract (the getters), narrowing the surface to the read side of the Action-Domain-Responder boundary.
Phalcon\Contracts\Domain\Payload\Readable
Uses Throwable
Method Summary
publicThrowable|nullgetException()Gets the potential exception thrown in the domain layerpublicmixedgetExtras()Gets arbitrary extra values produced by the domain layer.publicmixedgetInput()Gets the input received by the domain layer.publicmixedgetMessages()Gets the messages produced by the domain layer.publicmixedgetOutput()Gets the output produced from the domain layer.publicmixedgetStatus()Gets the status of this payload.Methods
getException()
public function getException(): Throwable|null;Gets the potential exception thrown in the domain layer
getExtras()
public function getExtras(): mixed;Gets arbitrary extra values produced by the domain layer.
getInput()
public function getInput(): mixed;Gets the input received by the domain layer.
getMessages()
public function getMessages(): mixed;Gets the messages produced by the domain layer.
getOutput()
public function getOutput(): mixed;Gets the output produced from the domain layer.
getStatus()
public function getStatus(): mixed;Gets the status of this payload.
Status values are drawn from the Status vocabulary.
@see \Phalcon\Domain\Payload\Status
Contracts\Domain\Payload\Writeable
InterfaceSource on GitHubCanonical write-only contract for a domain payload.
The domain layer builds a payload through this contract (the setters), narrowing the surface to the write side of the Action-Domain-Responder boundary.
Phalcon\Contracts\Domain\Payload\Writeable
Uses Throwable
Method Summary
publicPayloadsetException( Throwable$exception )Sets an exception produced by the domain layer.publicPayloadsetExtras( mixed$extras )Sets arbitrary extra values produced by the domain layer.publicPayloadsetInput( mixed$input )Sets the input received by the domain layer.publicPayloadsetMessages( mixed$messages )Sets the messages produced by the domain layer.publicPayloadsetOutput( mixed$output )Sets the output produced from the domain layer.publicPayloadsetStatus( mixed$status )Sets the status of this payload.Methods
setException()
public function setException( Throwable $exception ): Payload;Sets an exception produced by the domain layer.
setExtras()
public function setExtras( mixed $extras ): Payload;Sets arbitrary extra values produced by the domain layer.
setInput()
public function setInput( mixed $input ): Payload;Sets the input received by the domain layer.
setMessages()
public function setMessages( mixed $messages ): Payload;Sets the messages produced by the domain layer.
setOutput()
public function setOutput( mixed $output ): Payload;Sets the output produced from the domain layer.
setStatus()
public function setStatus( mixed $status ): Payload;Sets the status of this payload.
Status values are drawn from the Status vocabulary.
@see \Phalcon\Domain\Payload\Status
Contracts\Encryption\Crypt\Crypt
InterfaceSource on GitHubCanonical contract for Phalcon\Encryption\Crypt.
The encrypted payload produced by encrypt() uses the wire format:
iv ‖ hmac ‖ ciphertext ‖ tag
where hmac is present only when signing is enabled (useSigning(true),
the default) and tag is present only for AEAD ciphers (gcm/ccm).
The AEAD parameters (authData, authTag, authTagLength) are instance
state set through the relevant setters and shared across every
encrypt()/decrypt() call on the instance. A Crypt service shared
through the DI container is therefore not safe for interleaved AEAD
operations.
Phalcon\Contracts\Encryption\Crypt\Crypt
Method Summary
publicstringdecrypt(string$input,string|null$key = null)Decrypts a textpublicstringdecryptBase64(string$input,string|null$key = null)Decrypt a text that is coded as a base64 stringpublicstringencrypt(string$input,string|null$key = null)Encrypts a textpublicstringencryptBase64(string$input,string|null$key = null)Encrypts a text returning the result as a base64 stringpublicstringgetAuthData()Returns authentication datapublicstringgetAuthTag()Returns the authentication tagpublicintgetAuthTagLength()Returns the authentication tag lengthpublicarraygetAvailableCiphers()Returns a list of available cypherspublicstringgetCipher()Returns the current cipherpublicstringgetKey()Returns the encryption keypublicCryptsetAuthData( string$data )Sets authentication datapublicCryptsetAuthTag( string$tag )Sets the authentication tagpublicCryptsetAuthTagLength( int$length )Sets the authentication tag lengthpublicCryptsetCipher( string$cipher )Sets the cipher algorithmpublicCryptsetKey( string$key )Sets the encryption keypublicCryptsetPadding( int$scheme )Changes the padding scheme used.publicCryptuseSigning( bool$useSigning )Sets if the calculating message digest must be used.Methods
decrypt()
public function decrypt(
string $input,
string|null $key = null
): string;Decrypts a text
decryptBase64()
public function decryptBase64(
string $input,
string|null $key = null
): string;Decrypt a text that is coded as a base64 string
encrypt()
public function encrypt(
string $input,
string|null $key = null
): string;Encrypts a text
encryptBase64()
public function encryptBase64(
string $input,
string|null $key = null
): string;Encrypts a text returning the result as a base64 string
getAuthData()
public function getAuthData(): string;Returns authentication data
getAuthTag()
public function getAuthTag(): string;Returns the authentication tag
getAuthTagLength()
public function getAuthTagLength(): int;Returns the authentication tag length
getAvailableCiphers()
public function getAvailableCiphers(): array;Returns a list of available cyphers
getCipher()
public function getCipher(): string;Returns the current cipher
getKey()
public function getKey(): string;Returns the encryption key
setAuthData()
public function setAuthData( string $data ): Crypt;Sets authentication data
setAuthTag()
public function setAuthTag( string $tag ): Crypt;Sets the authentication tag
setAuthTagLength()
public function setAuthTagLength( int $length ): Crypt;Sets the authentication tag length
setCipher()
public function setCipher( string $cipher ): Crypt;Sets the cipher algorithm
setKey()
public function setKey( string $key ): Crypt;Sets the encryption key
setPadding()
public function setPadding( int $scheme ): Crypt;Changes the padding scheme used.
useSigning()
public function useSigning( bool $useSigning ): Crypt;Sets if the calculating message digest must be used.
Contracts\Encryption\Crypt\Padding\Pad
InterfaceSource on GitHubCanonical contract for Phalcon\Encryption\Crypt\Padding strategies.
The pad/unpad protocol operates on binary (8-bit) data. Implementations
must measure and slice the input with byte-true functions (strlen,
substr, or the mb_* family with the explicit "8bit" encoding); using
encoding-sensitive functions such as mb_strlen() on the padded plaintext
yields the wrong padding size whenever the bytes form valid multibyte
sequences.
Phalcon\Contracts\Encryption\Crypt\Padding\Pad
Method Summary
Methods
pad()
public function pad( int $paddingSize ): string;unpad()
public function unpad(
string $input,
int $blockSize
): int;Contracts\Encryption\Security\CryptoUtils
InterfaceSource on GitHubPhalcon\Contracts\Encryption\Security\CryptoUtils
Uses Phalcon\Encryption\Security\Random
Method Summary
publicstringcomputeHmac(string$data,string$key,string$algorithm,bool$raw = false)publicRandomgetRandom()publicintgetRandomBytes()publicstringgetSaltBytes( int$numberBytes = 0 )publicSecuritysetRandomBytes( int$randomBytes )Methods
computeHmac()
public function computeHmac(
string $data,
string $key,
string $algorithm,
bool $raw = false
): string;getRandom()
public function getRandom(): Random;getRandomBytes()
public function getRandomBytes(): int;getSaltBytes()
public function getSaltBytes( int $numberBytes = 0 ): string;setRandomBytes()
public function setRandomBytes( int $randomBytes ): Security;Contracts\Encryption\Security\CsrfProtection
InterfaceSource on GitHubPhalcon\Contracts\Encryption\Security\CsrfProtection
Method Summary
publicboolcheckToken(string|null$tokenKey = null,mixed$tokenValue = null,bool$destroyIfValid = true)publicSecuritydestroyToken()publicstring|nullgetRequestToken()publicstring|nullgetSessionToken()publicstring|nullgetToken()publicstring|nullgetTokenKey()Methods
checkToken()
public function checkToken(
string|null $tokenKey = null,
mixed $tokenValue = null,
bool $destroyIfValid = true
): bool;destroyToken()
public function destroyToken(): Security;getRequestToken()
public function getRequestToken(): string|null;getSessionToken()
public function getSessionToken(): string|null;getToken()
public function getToken(): string|null;getTokenKey()
public function getTokenKey(): string|null;Contracts\Encryption\Security\JWT\Signer\Signer
InterfaceSource on GitHubCanonical contract for JWT Signer classes
Phalcon\Contracts\Encryption\Security\JWT\Signer\Signer
Method Summary
publicstringgetAlgHeader()Return the value that is used for the "alg" headerpublicstringgetAlgorithm()Return the algorithm usedpublicstringsign(string$payload,string$passphrase)Sign a payload using the passphrasepublicboolverify(string$source,string$payload,string$passphrase)Verify a passed source with a payload and passphraseMethods
getAlgHeader()
public function getAlgHeader(): string;Return the value that is used for the “alg” header
getAlgorithm()
public function getAlgorithm(): string;Return the algorithm used
sign()
public function sign(
string $payload,
string $passphrase
): string;Sign a payload using the passphrase
verify()
public function verify(
string $source,
string $payload,
string $passphrase
): bool;Verify a passed source with a payload and passphrase
Contracts\Encryption\Security\PasswordSecurity
InterfaceSource on GitHubPhalcon\Contracts\Encryption\Security\PasswordSecurity
Method Summary
publicboolcheckHash(string$password,string$passwordHash,int$maxPassLength = 0)publicintgetDefaultHash()publicarraygetHashInformation( string$hash )publicintgetWorkFactor()publicstringhash(string$password,array$options = [])publicboolisLegacyHash( string$passwordHash )publicSecuritysetDefaultHash( int$defaultHash )publicSecuritysetWorkFactor( int$workFactor )Methods
checkHash()
public function checkHash(
string $password,
string $passwordHash,
int $maxPassLength = 0
): bool;getDefaultHash()
public function getDefaultHash(): int;getHashInformation()
public function getHashInformation( string $hash ): array;getWorkFactor()
public function getWorkFactor(): int;hash()
public function hash(
string $password,
array $options = []
): string;isLegacyHash()
public function isLegacyHash( string $passwordHash ): bool;setDefaultHash()
public function setDefaultHash( int $defaultHash ): Security;setWorkFactor()
public function setWorkFactor( int $workFactor ): Security;Contracts\Encryption\Security\Security
InterfaceSource on GitHubPhalcon\Contracts\Encryption\Security\CryptoUtilsPhalcon\Contracts\Encryption\Security\Security- extendsPhalcon\Contracts\Encryption\Security\CryptoUtils,Phalcon\Contracts\Encryption\Security\CsrfProtection,Phalcon\Contracts\Encryption\Security\PasswordSecurity
Contracts\Encryption\Security\Uuid\NodeProvider
InterfaceSource on GitHubPhalcon\Contracts\Encryption\Security\Uuid\NodeProvider
Method Summary
Methods
getNode()
public function getNode(): string;Contracts\Encryption\Security\Uuid\TimeBasedUuid
InterfaceSource on GitHubPhalcon\Contracts\Encryption\Security\Uuid\TimeBasedUuid
Method Summary
Methods
getDateTime()
public function getDateTime(): \DateTimeImmutable;getNode()
public function getNode(): string;Contracts\Encryption\Security\Uuid\Uuid
InterfaceSource on GitHubCanonical marker contract for UUID version adapters.
Also carries the standard RFC 4122 namespace UUIDs as constants.
Phalcon\Contracts\Encryption\Security\Uuid\Uuid
Constants
stringNAMESPACE_DNS = "6ba7b810-9dad-11d1-80b4-00c04fd430c8"stringNAMESPACE_OID = "6ba7b812-9dad-11d1-80b4-00c04fd430c8"stringNAMESPACE_URL = "6ba7b811-9dad-11d1-80b4-00c04fd430c8"stringNAMESPACE_X500 = "6ba7b814-9dad-11d1-80b4-00c04fd430c8"Contracts\Events\Enumerable
InterfaceSource on GitHubOptional capability contract for an events manager that can report every
attached listener in one call. Callers detect support with instanceof.
Deliberately separate from Manager rather than a member of it: adding a member to a published interface breaks every implementor, so a second, narrow interface states the capability without touching the first.
Tooling that reports on an events manager type-hints this instead of the concrete Manager, so it depends on a published contract rather than on an implementation detail that is free to change.
Phalcon\Contracts\Events\Enumerable
Method Summary
Methods
getListenerMap()
public function getListenerMap(): array;Returns every event type that currently has at least one listener, mapped to that type’s listeners. Types contributed by subscribers are included, because addSubscriber() attaches through the regular listener pipeline.
Contracts\Events\Event
InterfaceSource on GitHubCanonical contract for Phalcon\Events\Event.
Phalcon\Contracts\Events\Event
Method Summary
publicmixedgetData()Gets event datapublicmixedgetType()Gets event typepublicboolisCancelable()Check whether the event is cancelablepublicboolisStopped()Check whether the event is currently stoppedpublicEventsetData( mixed$data = null )Sets event datapublicEventsetType( string$type )Sets event typepublicEventstop()Stops the event preventing propagationMethods
getData()
public function getData(): mixed;Gets event data
getType()
public function getType(): mixed;Gets event type
isCancelable()
public function isCancelable(): bool;Check whether the event is cancelable
isStopped()
public function isStopped(): bool;Check whether the event is currently stopped
setData()
public function setData( mixed $data = null ): Event;Sets event data
setType()
public function setType( string $type ): Event;Sets event type
stop()
public function stop(): Event;Stops the event preventing propagation
Contracts\Events\EventsAware
InterfaceSource on GitHubCanonical contract for Phalcon\Events\EventsAwareInterface. Implemented by components that accept an events manager and dispatch through it.
Cross-references the legacy ManagerInterface (not the canonical Manager contract) to preserve LSP for the many AbstractEventsAware subclasses that already type-hint ManagerInterface. ManagerInterface extends Manager, so this remains type-compatible with any code that needs the canonical surface.
Phalcon\Contracts\Events\EventsAware
Uses Phalcon\Events\ManagerInterface
Method Summary
publicManagerInterface|nullgetEventsManager()Returns the internal events managerpublicvoidsetEventsManager( ManagerInterface$eventsManager )Sets the events managerMethods
getEventsManager()
public function getEventsManager(): ManagerInterface|null;Returns the internal events manager
setEventsManager()
public function setEventsManager( ManagerInterface $eventsManager ): void;Sets the events manager
Contracts\Events\Manager
InterfaceSource on GitHubCanonical contract for Phalcon\Events\Manager.
Phalcon\Contracts\Events\Manager
Method Summary
publicvoidaddSubscriber( Subscriber$subscriber )Registers an event subscriber. The subscriber's getSubscribedEvents()publicboolarePrioritiesEnabled()Returns whether priority ordering is currently enabled.publicvoidattach(string$eventType,mixed$handler,int$priority = self::DEFAULT_PRIORITY)Attach a listener to the events manager.publicvoidclearSubscribers()Removes every registered subscriber and detaches each listener theypublicvoidcollectResponses( bool$collect )Toggle response collection on/off.publicvoiddetach(string$eventType,mixed$handler)Detach a listener from the events manager.publicvoiddetachAll( string|null$type = null )Removes all listeners - globally or for a single event type.publicvoidenablePriorities( bool$enablePriorities )Toggle priority ordering on/off.publicfire(string$eventType,object$source,mixed$data = null,bool$cancelable = true)Fires an event, notifying the active listeners.publicarraygetListeners( string$type )Returns all listeners attached to the given event type.publicarraygetResponses()Returns the responses recorded during the last fire (when collecting).publicarraygetSubscribers()Returns the list of registered subscriber instances.publicboolhasListeners( string$type )Check whether the given event type has any listeners.publicboolisCollecting()Check whether the manager is currently collecting responses.publicboolisValidHandler( mixed$handler )Returns true when the given handler is an object or callable.publicvoidremoveSubscriber( Subscriber$subscriber )Removes a previously registered subscriber. Detaches every listener theConstants
intDEFAULT_PRIORITY = 100Methods
addSubscriber()
public function addSubscriber( Subscriber $subscriber ): void;Registers an event subscriber. The subscriber’s getSubscribedEvents() map is parsed and each entry is attached through the regular listener pipeline.
arePrioritiesEnabled()
public function arePrioritiesEnabled(): bool;Returns whether priority ordering is currently enabled.
attach()
public function attach(
string $eventType,
mixed $handler,
int $priority = self::DEFAULT_PRIORITY
): void;Attach a listener to the events manager.
clearSubscribers()
public function clearSubscribers(): void;Removes every registered subscriber and detaches each listener they contributed. Listeners attached via attach() are untouched.
collectResponses()
public function collectResponses( bool $collect ): void;Toggle response collection on/off.
detach()
public function detach(
string $eventType,
mixed $handler
): void;Detach a listener from the events manager.
detachAll()
public function detachAll( string|null $type = null ): void;Removes all listeners - globally or for a single event type.
enablePriorities()
public function enablePriorities( bool $enablePriorities ): void;Toggle priority ordering on/off.
fire()
public function fire(
string $eventType,
object $source,
mixed $data = null,
bool $cancelable = true
);Fires an event, notifying the active listeners.
getListeners()
public function getListeners( string $type ): array;Returns all listeners attached to the given event type.
getResponses()
public function getResponses(): array;Returns the responses recorded during the last fire (when collecting).
getSubscribers()
public function getSubscribers(): array;Returns the list of registered subscriber instances.
hasListeners()
public function hasListeners( string $type ): bool;Check whether the given event type has any listeners.
isCollecting()
public function isCollecting(): bool;Check whether the manager is currently collecting responses.
isValidHandler()
public function isValidHandler( mixed $handler ): bool;Returns true when the given handler is an object or callable.
removeSubscriber()
public function removeSubscriber( Subscriber $subscriber ): void;Removes a previously registered subscriber. Detaches every listener the subscriber declared via getSubscribedEvents(). Idempotent.
Contracts\Events\Stoppable
InterfaceSource on GitHubPhalcon’s local mirror of PSR-14 StoppableEventInterface. Identical shape; not extended from the PSR interface because the Zephir extension cannot reference Composer-loaded interfaces at build time. A separate bridge package exposes a PSR-14 adapter.
Phalcon\Contracts\Events\Stoppable
Method Summary
Methods
isPropagationStopped()
public function isPropagationStopped(): bool;Returns true when the event must stop propagating to subsequent listeners.
Contracts\Events\Subscriber
InterfaceSource on GitHubContract for event subscriber classes. A subscriber declares the events it wants to listen to via a static map; Events\Manager parses the map and attaches each entry as a regular listener.
Accepted value shapes per event key:
‘event:name’ => ‘methodName’ ‘event:name’ => [‘methodName’, priority] ‘event:name’ => [ [‘methodName1’], [‘methodName2’, priority], ]
Keys can be either a Phalcon event string (e.g. “db:beforeQuery”) or a fully qualified event class name.
Wildcard subscriptions: Phalcon’s manager fires both the prefix queue and the full-name queue (e.g. “db” is fired before “db:beforeQuery”). To subscribe to every event of a component, use the prefix as the key:
‘db’ => ‘onAnyDbEvent’ // fires for db:beforeQuery, db:afterQuery, …
Phalcon\Contracts\Events\Subscriber
Method Summary
Methods
getSubscribedEvents()
public static function getSubscribedEvents(): array;Returns a map of event name => listener config. Called once per Manager::addSubscriber() / removeSubscriber() call.
Contracts\Filter\Sanitizer
InterfaceSource on GitHubThe contract for sanitizers registered in Phalcon\Filter\Filter.
A sanitizer is an invokable object: it must expose a public __invoke()
method that receives the value to sanitize as its first parameter and
returns the sanitized value. Additional parameters, when a sanitizer
needs them (e.g. regex, replace), must be declared after the value
parameter; Phalcon\Filter\Filter::sanitize() forwards them in order.
__invoke() is intentionally not declared here: implementations type
their value parameter differently (string for text-only sanitizers,
untyped for coercing ones), and PHP parameter variance does not allow an
implementation to narrow a parameter declared by an interface.
A sanitizer operates on a single value. Array handling (one level of recursion by default) is the responsibility of Phalcon\Filter\Filter::sanitize(), not of the sanitizer.
Phalcon\Contracts\Filter\Sanitizer
Contracts\Flash\Flash
InterfaceSource on GitHubCanonical contract for Phalcon\Flash messengers.
Note: output() and clear() are part of the concrete Direct / Session
API and are not declared on this contract; they are scheduled to be added in
the next major version.
Phalcon\Contracts\Flash\Flash
Method Summary
publicstring|nullerror( string$message )Shows a HTML error messagepublicstring|nullmessage(string$type,string$message)Outputs a messagepublicstring|nullnotice( string$message )Shows a HTML notice/information messagepublicstring|nullsuccess( string$message )Shows a HTML success messagepublicstring|nullwarning( string$message )Shows a HTML warning messageMethods
error()
public function error( string $message ): string|null;Shows a HTML error message
message()
public function message(
string $type,
string $message
): string|null;Outputs a message
Note: the shipped implementations (Direct, Session) accept
string|array for $message; this contract declares string and is
scheduled to be widened to mixed in the next major version. Delivery
semantics differ per implementation: Direct::message() renders and
emits the message immediately, while Session::message() stores the raw
message for output on a later request.
notice()
public function notice( string $message ): string|null;Shows a HTML notice/information message
success()
public function success( string $message ): string|null;Shows a HTML success message
warning()
public function warning( string $message ): string|null;Shows a HTML warning message
Contracts\Forms\Schema
InterfaceSource on GitHubContract for objects that supply a normalized list of form element definitions. Implementations may source the definitions from a PHP array, a JSON document, a YAML file, or any other format.
Each returned definition must be an associative array containing at least:
- ‘type’ (string) - element type key (e.g. ‘text’, ‘select’, ‘checkgroup’)
- ‘name’ (string) - the HTML name attribute value
Optional keys per definition:
- ‘label’ (string) - visible label text
- ‘default’ (mixed) - pre-populated default value
- ‘attributes’ (array) - additional HTML attributes
- ‘filters’ (array|string) - filter names applied on bind()
- ‘validators’ (array) - ValidatorInterface instances
- ‘options’ (array) - choices for select / checkgroup / radiogroup
Phalcon\Contracts\Forms\Schema
Method Summary
Methods
load()
public function load(): array;Returns an ordered list of normalized element definitions.
Contracts\Front\FrontController
InterfaceSource on GitHub[FrontController][] affords an entry point into the outermost presentation layer in any execution context (HTTP, CLI, etc.).
Phalcon\Contracts\Front\FrontController
Method Summary
Methods
run()
public function run(): int;Runs the front controller.
-
Directives:
-
Implementations MUST report success by returning an integer
0. -
Implementations MUST report non-success by returning an integer between
1and254(inclusive). -
Implementations MUST gracefully handle all [Throwable][]s.
-
Implementations MUST NOT [
exit()][], [die()][], or otherwise avoid returning.
-
-
Notes:
-
The return value is intended as an exit status code. Exit status codes may be received initially by the in-process logic that invoked
run()(bootstrap scripts, test harnesses, etc.), and may ultimately be received by a parent process (shell, supervisor, init system, CI runner, monitoring tool, or similar) via [exit()][]. Whether or not the exit status is consumed by the calling code or parent process depends on the execution environment: php-fpm and mod_php typically have no consumer, whereas worker loops, supervised long-running processes, runtime layers, and CI harnesses do. -
“Success” and “non-success” are context-dependent. In an HTTP context, “success” typically means that the request was processed and a response was emitted regardless of the HTTP status code, whereas “non-success” may indicate that a [Throwable][] had to be handled by the FrontController itself. In a command line context, “success” typically means that the command completed without errors, whereas “non-success” may be one of several error conditions (cf. the [
sysexits.h][] conventions where applicable). -
The exit status code
255is reserved by PHP itself. Cf. [exit()][]: “Exit codes should be in the range 0 to 254, the exit code 255 is reserved by PHP and should not be used.” -
Handle all possible exceptions. The logic calling the front controller should not have to deal with any exceptions bubbling up from it.
-
Graceful handling means returning, not exiting. A “graceful” handler catches the [Throwable][], turns it into a non-success exit status, and returns that status from
run()rather than calling [exit()][]. -
Return the exit status; leave termination to the caller. The value of an exit status code comes from letting the caller decide what to do with it: a worker loop, queue worker, or test harness needs
run()to hand control back so it can continue, retry, or assert on the result. An implementation that calls [exit()][] insiderun()prevents those uses, terminating the process before the caller regains control.
-
Contracts\Front\FrontTypeAliases
InterfaceSource on GitHub[FrontTypeAliases][] provides custom PHPStan types to aid static analysis.
-
front_exit_status_int int<0,254>- An
intexit status code:0for success,1to254for non-success. The value255is reserved by PHP itself.
- An
Phalcon\Contracts\Front\FrontTypeAliases
Contracts\Html\Helper\Input\SelectData
InterfaceSource on GitHubInterface for SELECT option data providers.
Return format: [value => label] for flat options; [groupLabel => [value => label, …]] for optgroups.
Phalcon\Contracts\Html\Helper\Input\SelectData
Method Summary
Methods
getAttributes()
public function getAttributes(): array;Returns the per-option attribute map.
Format: [optionValue => [attrName => stringValue, …]]. Implementations must return resolved string values; no escaping, ordering, or rendering is performed here.
getOptions()
public function getOptions(): array;Contracts\Http\AttributeRequest
InterfaceSource on GitHubExtends the request contract with the native attribute bag.
getAttributes() already exists on the concrete Phalcon\Http\Request; this
interface exposes it as a contract without touching RequestInterface
(adding a method there would break userland implementers). It lets consumers
type against the attribute-bearing request without depending on the concrete.
Phalcon\Http\RequestInterfacePhalcon\Contracts\Http\AttributeRequest
Uses Phalcon\Http\RequestInterface · Phalcon\Http\Request\Bag\AttributeBag
Method Summary
Methods
getAttributes()
public function getAttributes(): AttributeBag;Returns the request attribute bag.
Contracts\Http\HttpTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Http namespace.
Phalcon\Contracts\Http\HttpTypes
Uses Phalcon\Http\Cookie\CookieInterface · Phalcon\Http\Request\FileInterface
Contracts\Image\ImageTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Image namespace.
This is a type registry, not a contract. It declares no members and must not be implemented; it exists only so that every shape below has a single definition, imported where it is needed with a phpstan-import-type tag naming this interface as the source.
Alias names are prefixed with image_ because PHPStan resolves imported
type names per file and has no namespacing for them: the prefix is what
keeps generic names such as config from clashing with an alias imported
from another namespace into the same file.
Phalcon\Contracts\Image\ImageTypes
Uses Phalcon\Image\Adapter\AdapterInterface
Contracts\Logger\Adapter\Adapter
InterfaceSource on GitHubCanonical contract for Phalcon\Logger adapters.
Phalcon\Contracts\Logger\Adapter\Adapter
Uses Phalcon\Logger\Formatter\FormatterInterface · Phalcon\Logger\Item
Method Summary
publicAdapteradd( Item$item )Adds a message in the queuepublicAdapterbegin()Starts a transactionpublicboolclose()Closes the loggerpublicAdaptercommit()Commits the internal transactionpublicFormatterInterfacegetFormatter()Returns the internal formatterpublicboolinTransaction()Returns the whether the logger is currently in an active transaction orpublicvoidprocess( Item$item )Processes the message in the adapterpublicAdapterrollback()Rollbacks the internal transactionpublicAdaptersetFormatter( FormatterInterface$formatter )Sets the message formatterMethods
add()
public function add( Item $item ): Adapter;Adds a message in the queue
begin()
public function begin(): Adapter;Starts a transaction
close()
public function close(): bool;Closes the logger
commit()
public function commit(): Adapter;Commits the internal transaction
getFormatter()
public function getFormatter(): FormatterInterface;Returns the internal formatter
inTransaction()
public function inTransaction(): bool;Returns the whether the logger is currently in an active transaction or not
process()
public function process( Item $item ): void;Processes the message in the adapter
rollback()
public function rollback(): Adapter;Rollbacks the internal transaction
setFormatter()
public function setFormatter( FormatterInterface $formatter ): Adapter;Sets the message formatter
Contracts\Logger\Formatter\Formatter
InterfaceSource on GitHubCanonical contract for Phalcon\Logger formatters.
Phalcon\Contracts\Logger\Formatter\Formatter
Uses Phalcon\Logger\Item
Method Summary
Methods
format()
public function format( Item $item ): string;Applies a format to an item
Contracts\Logger\Logger
InterfaceSource on GitHubCanonical contract for Phalcon\Logger\Logger.
Phalcon\Contracts\Logger\Logger
Uses Phalcon\Contracts\Logger\Adapter\Adapter
Method Summary
publicvoidalert(string$message,array$context = [])Action must be taken immediately.publicvoidcritical(string$message,array$context = [])Critical conditions.publicvoiddebug(string$message,array$context = [])Detailed debug information.publicvoidemergency(string$message,array$context = [])System is unusable.publicvoiderror(string$message,array$context = [])Runtime errors that do not require immediate action but should typicallypublicAdaptergetAdapter( string$name )Returns an adapter from the stackpublicarraygetAdapters()Returns the adapter stack arraypublicintgetLogLevel()Returns the log levelpublicstringgetName()Returns the name of the loggerpublicvoidinfo(string$message,array$context = [])Interesting events.publicvoidlog(mixed$level,string$message,array$context = [])Logs with an arbitrary level.publicvoidnotice(string$message,array$context = [])Normal but significant events.publicvoidtrace(string$message,array$context = [])Extra-verbose diagnostic output.publicvoidwarning(string$message,array$context = [])Exceptional occurrences that are not errors.Methods
alert()
public function alert(
string $message,
array $context = []
): void;Action must be taken immediately.
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
critical()
public function critical(
string $message,
array $context = []
): void;Critical conditions.
Example: Application component unavailable, unexpected exception.
debug()
public function debug(
string $message,
array $context = []
): void;Detailed debug information.
emergency()
public function emergency(
string $message,
array $context = []
): void;System is unusable.
error()
public function error(
string $message,
array $context = []
): void;Runtime errors that do not require immediate action but should typically be logged and monitored.
getAdapter()
public function getAdapter( string $name ): Adapter;Returns an adapter from the stack
getAdapters()
public function getAdapters(): array;Returns the adapter stack array
getLogLevel()
public function getLogLevel(): int;Returns the log level
getName()
public function getName(): string;Returns the name of the logger
info()
public function info(
string $message,
array $context = []
): void;Interesting events.
Example: User logs in, SQL logs.
log()
public function log(
mixed $level,
string $message,
array $context = []
): void;Logs with an arbitrary level.
An unknown level (a typo or an unmapped value) is not rejected; it maps to the CUSTOM level and is logged, rather than raising an exception.
notice()
public function notice(
string $message,
array $context = []
): void;Normal but significant events.
trace()
public function trace(
string $message,
array $context = []
): void;Extra-verbose diagnostic output.
warning()
public function warning(
string $message,
array $context = []
): void;Exceptional occurrences that are not errors.
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Contracts\Messages\Messages
InterfaceSource on GitHubCanonical contract for Phalcon\Messages\Messages.
The collection stores Phalcon\Messages\MessageInterface objects and is
iterated by integer position. An entry added under a string key through the
ArrayAccess interface stays reachable by that offset but is not visited
during iteration (foreach), which walks the integer sequence only.
@extends ArrayAccess<array-key, mixed> @extends Iterator<int, MessageInterface>
\ArrayAccessPhalcon\Contracts\Messages\Messages- extends\ArrayAccess,\Countable,\Iterator
Uses ArrayAccess · Countable · Iterator · Phalcon\Messages\MessageInterface
Method Summary
publicvoidappendMessage( MessageInterface$message )Appends a message to the collectionpublicappendMessages( mixed$messages )Appends an array of messages to the collectionpublicarrayfilter( string$fieldName )Filters the message collection by field nameMethods
appendMessage()
public function appendMessage( MessageInterface $message ): void;Appends a message to the collection
appendMessages()
public function appendMessages( mixed $messages );Appends an array of messages to the collection
filter()
public function filter( string $fieldName ): array;Filters the message collection by field name
Contracts\Messages\MessagesTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Messages namespace.
This is a type registry, not a contract. It declares no members and must not be implemented; it exists only so that every shape below has a single definition, imported where it is needed with a phpstan-import-type tag naming this interface as the source.
Alias names are prefixed with messages_ because PHPStan resolves imported
type names per file and has no namespacing for them: the prefix is what
keeps generic names such as metadata from clashing with an alias imported
from another namespace into the same file.
Phalcon\Contracts\Messages\MessagesTypes
Uses Phalcon\Messages\MessageInterface
Contracts\Mvc\Dispatcher
InterfaceSource on GitHubCanonical contract for Phalcon\Mvc\Dispatcher.
Phalcon\Contracts\Dispatcher\DispatcherPhalcon\Contracts\Mvc\Dispatcher
Uses Phalcon\Contracts\Dispatcher\Dispatcher · Phalcon\Mvc\ControllerInterface
Method Summary
publicControllerInterface|nullgetActiveController()Returns the active controller in the dispatcherpublicstringgetControllerName()Gets last dispatched controller namepublicControllerInterface|nullgetLastController()Returns the latest dispatched controllerpublicDispatcherContractsetControllerName( string$controllerName )Sets the controller name to be dispatchedpublicDispatcherContractsetControllerSuffix( string$controllerSuffix )Sets the default controller suffixpublicDispatcherContractsetDefaultController( string$controllerName )Sets the default controller nameMethods
getActiveController()
public function getActiveController(): ControllerInterface|null;Returns the active controller in the dispatcher
getControllerName()
public function getControllerName(): string;Gets last dispatched controller name
getLastController()
public function getLastController(): ControllerInterface|null;Returns the latest dispatched controller
setControllerName()
public function setControllerName( string $controllerName ): DispatcherContract;Sets the controller name to be dispatched
setControllerSuffix()
public function setControllerSuffix( string $controllerSuffix ): DispatcherContract;Sets the default controller suffix
setDefaultController()
public function setDefaultController( string $controllerName ): DispatcherContract;Sets the default controller name
Contracts\Mvc\Model\Relation\CacheKeyProvider
InterfaceSource on GitHubInterface for models that provide a custom unique key for the reusable records cache in the Model Manager. Implement this interface when the default object-identity based key (unique_key) does not produce stable cache hits across multiple object instances that represent the same database record.
Phalcon\Contracts\Mvc\Model\Relation\CacheKeyProvider
Method Summary
Methods
getUniqueKey()
public function getUniqueKey(): string;Returns a string that uniquely identifies this model instance for use as the key in the reusable records cache.
Contracts\Paginator\Adapter
InterfaceSource on GitHubInterface for Phalcon\Paginator adapters
Phalcon\Contracts\Paginator\Adapter
Method Summary
publicintgetLimit()Get current rows limitpublicRepositorypaginate()Returns a slice of the resultset to show in the paginationpublicAdaptersetCurrentPage( int$page )Set the current page numberpublicAdaptersetLimit( int$limit )Set current rows limitMethods
getLimit()
public function getLimit(): int;Get current rows limit
paginate()
public function paginate(): Repository;Returns a slice of the resultset to show in the pagination
setCurrentPage()
public function setCurrentPage( int $page ): Adapter;Set the current page number
setLimit()
public function setLimit( int $limit ): Adapter;Set current rows limit
Contracts\Paginator\PaginatorTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Paginator namespace.
This is a type registry, not a contract. It declares no members and must not be implemented; it exists only so that every shape below has a single definition, imported where it is needed with a phpstan-import-type tag naming this interface as the source.
Alias names are prefixed with paginator_ because PHPStan resolves
imported type names per file and has no namespacing for them: the prefix
is what keeps generic names such as config from clashing with an alias
imported from another namespace into the same file.
Phalcon\Contracts\Paginator\PaginatorTypes
Uses Phalcon\Mvc\Model\Query\Builder
Contracts\Paginator\Repository
InterfaceSource on GitHubInterface for the repository of current state Phalcon\Paginator\AdapterInterface::paginate()
Two adapter dialects fill this repository:
- Offset adapters (Model, NativeArray, QueryBuilder) populate every property as a sequential page number / item count.
- Cursor adapters (QueryBuilderCursor) reuse the same properties with a
different meaning:
getCurrent()/getNext()carry keyset cursor values rather than page numbers, andgetTotalItems(),getLast()andgetPrevious()are not computed (they return 0).
Phalcon\Contracts\Paginator\Repository
Method Summary
publicarraygetAliases()Gets the aliases for properties repositorypublicintgetCurrent()Gets number of the current pagepublicintgetFirst()Gets number of the first pagepublicmixedgetItems()Gets the items on the current pagepublicintgetLast()Gets number of the last pagepublicintgetLimit()Gets current rows limitpublicintgetNext()Gets number of the next pagepublicintgetPrevious()Gets number of the previous pagepublicintgetTotalItems()Gets the total number of itemspublicRepositorysetAliases( array$aliases )Sets the aliases for properties repositorypublicRepositorysetProperties( array$properties )Sets values for properties of the repositoryConstants
stringPROPERTY_CURRENT_PAGE = "current"stringPROPERTY_FIRST_PAGE = "first"stringPROPERTY_ITEMS = "items"stringPROPERTY_LAST_PAGE = "last"stringPROPERTY_LIMIT = "limit"stringPROPERTY_NEXT_PAGE = "next"stringPROPERTY_PREVIOUS_PAGE = "previous"stringPROPERTY_TOTAL_ITEMS = "total_items"Methods
getAliases()
public function getAliases(): array;Gets the aliases for properties repository
getCurrent()
public function getCurrent(): int;Gets number of the current page
Cursor adapters store the cursor value used for the current page here (0 on the first page), not a sequential page number.
getFirst()
public function getFirst(): int;Gets number of the first page
getItems()
public function getItems(): mixed;Gets the items on the current page
getLast()
public function getLast(): int;Gets number of the last page
Cursor adapters do not compute this and return 0.
getLimit()
public function getLimit(): int;Gets current rows limit
getNext()
public function getNext(): int;Gets number of the next page
Cursor adapters store the next cursor value here rather than a page number; 0 means there is no next page.
getPrevious()
public function getPrevious(): int;Gets number of the previous page
Cursor adapters do not compute this and return 0.
getTotalItems()
public function getTotalItems(): int;Gets the total number of items
Cursor adapters do not compute this and return 0.
setAliases()
public function setAliases( array $aliases ): Repository;Sets the aliases for properties repository
setProperties()
public function setProperties( array $properties ): Repository;Sets values for properties of the repository
Contracts\Queue\ConnectionFactory
InterfaceSource on GitHubBuilds a Context: the entry point of every adapter.
Phalcon\Contracts\Queue\ConnectionFactory
Method Summary
Methods
createContext()
public function createContext(): Context;Creates a context (a session/connection to the transport).
Contracts\Queue\Consumer
InterfaceSource on GitHubReceives messages from a single queue.
Phalcon\Contracts\Queue\Consumer
Method Summary
publicvoidacknowledge( Message$message )Acknowledges the message; the transport may then discard it.publicQueuegetQueue()Returns the queue this consumer reads from.publicMessage|nullreceive( int$timeout = 0 )Receives a message, blocking up to timeout milliseconds (0 = blockpublicMessage|nullreceiveNoWait()Receives a message without blocking, or null when none is ready.publicvoidreject(Message$message,bool$requeue = false)Rejects the message. When requeue is true the transport redelivers it.Methods
acknowledge()
public function acknowledge( Message $message ): void;Acknowledges the message; the transport may then discard it.
getQueue()
public function getQueue(): Queue;Returns the queue this consumer reads from.
receive()
public function receive( int $timeout = 0 ): Message|null;Receives a message, blocking up to timeout milliseconds (0 = block until one is available). Returns null when none arrives in time.
receiveNoWait()
public function receiveNoWait(): Message|null;Receives a message without blocking, or null when none is ready.
reject()
public function reject(
Message $message,
bool $requeue = false
): void;Rejects the message. When requeue is true the transport redelivers it.
Contracts\Queue\Context
InterfaceSource on GitHubA session with the transport. Factory for messages, destinations, producers and consumers.
Phalcon\Contracts\Queue\Context
Method Summary
publicvoidclose()Closes the context and releases its resources.publicConsumercreateConsumer( Destination$destination )Creates a consumer for the given destination.publicMessagecreateMessage(string$body = "",array$properties = [],array$headers = [])Creates a message with an optional body, properties and headers.publicProducercreateProducer()Creates a producer.publicQueuecreateQueue( string$queueName )Creates a queue destination by name.publicSubscriptionConsumercreateSubscriptionConsumer()Creates a subscription consumer for consuming from several queues.publicQueuecreateTemporaryQueue()Creates a temporary queue tied to the lifetime of the context.publicTopiccreateTopic( string$topicName )Creates a topic destination by name.publicvoidpurgeQueue( Queue$queue )Removes all messages from the given queue.Methods
close()
public function close(): void;Closes the context and releases its resources.
createConsumer()
public function createConsumer( Destination $destination ): Consumer;Creates a consumer for the given destination.
createMessage()
public function createMessage(
string $body = "",
array $properties = [],
array $headers = []
): Message;Creates a message with an optional body, properties and headers.
createProducer()
public function createProducer(): Producer;Creates a producer.
createQueue()
public function createQueue( string $queueName ): Queue;Creates a queue destination by name.
createSubscriptionConsumer()
public function createSubscriptionConsumer(): SubscriptionConsumer;Creates a subscription consumer for consuming from several queues.
createTemporaryQueue()
public function createTemporaryQueue(): Queue;Creates a temporary queue tied to the lifetime of the context.
createTopic()
public function createTopic( string $topicName ): Topic;Creates a topic destination by name.
purgeQueue()
public function purgeQueue( Queue $queue ): void;Removes all messages from the given queue.
Contracts\Queue\Destination
InterfaceSource on GitHubMarker interface for a message destination: a Queue or a Topic.
Phalcon\Contracts\Queue\Destination
Contracts\Queue\Inspectable
InterfaceSource on GitHubOptional capability contract for a transport that can report statistics for
a queue (for example ready, delayed and buried job counts). Callers detect
support with instanceof.
The array returned by getStats() is ADAPTER-NATIVE: its keys and their semantics are defined by the implementing adapter and are NOT guaranteed to be uniform across adapters. It is an inspection surface, not a portable or normalized schema. Each implementation documents the exact keys it returns.
Phalcon\Contracts\Queue\Inspectable
Method Summary
Methods
getStats()
public function getStats( Queue $queue ): array;Returns statistics for the given queue.
Contracts\Queue\Message
InterfaceSource on GitHubA message exchanged through the transport. Carries a body, application properties, transport headers and the standard messaging metadata.
Phalcon\Contracts\Queue\Message
Method Summary
publicstringgetBody()Returns the message body.publicstring|nullgetCorrelationId()Returns the correlation id used to correlate request/reply messages.publicmixedgetHeader(string$name,mixed$defaultValue = null)Returns a single header value, or the default when it is not set.publicarraygetHeaders()Returns all transport headers.publicstring|nullgetMessageId()Returns the message id.publicarraygetProperties()Returns all application properties.publicmixedgetProperty(string$name,mixed$defaultValue = null)Returns a single property value, or the default when it is not set.publicstring|nullgetReplyTo()Returns the reply-to destination name.publicint|nullgetTimestamp()Returns the timestamp (in milliseconds) or null when it is not set.publicboolisRedelivered()Whether the message has been redelivered.publicvoidsetBody( string$body )Sets the message body.publicvoidsetCorrelationId( string$correlationId )Sets the correlation id.publicvoidsetHeader(string$name,mixed$value)Sets a single transport header.publicvoidsetHeaders( array$headers )Replaces all transport headers.publicvoidsetMessageId( string$messageId )Sets the message id.publicvoidsetProperties( array$properties )Replaces all application properties.publicvoidsetProperty(string$name,mixed$value)Sets a single application property.publicvoidsetRedelivered( bool$redelivered )Marks the message as redelivered.publicvoidsetReplyTo( string$replyTo )Sets the reply-to destination name.publicvoidsetTimestamp( int$timestamp )Sets the timestamp (in milliseconds).Methods
getBody()
public function getBody(): string;Returns the message body.
getCorrelationId()
public function getCorrelationId(): string|null;Returns the correlation id used to correlate request/reply messages.
getHeader()
public function getHeader(
string $name,
mixed $defaultValue = null
): mixed;Returns a single header value, or the default when it is not set.
getHeaders()
public function getHeaders(): array;Returns all transport headers.
getMessageId()
public function getMessageId(): string|null;Returns the message id.
getProperties()
public function getProperties(): array;Returns all application properties.
getProperty()
public function getProperty(
string $name,
mixed $defaultValue = null
): mixed;Returns a single property value, or the default when it is not set.
getReplyTo()
public function getReplyTo(): string|null;Returns the reply-to destination name.
getTimestamp()
public function getTimestamp(): int|null;Returns the timestamp (in milliseconds) or null when it is not set.
isRedelivered()
public function isRedelivered(): bool;Whether the message has been redelivered.
setBody()
public function setBody( string $body ): void;Sets the message body.
setCorrelationId()
public function setCorrelationId( string $correlationId ): void;Sets the correlation id.
setHeader()
public function setHeader(
string $name,
mixed $value
): void;Sets a single transport header.
setHeaders()
public function setHeaders( array $headers ): void;Replaces all transport headers.
setMessageId()
public function setMessageId( string $messageId ): void;Sets the message id.
setProperties()
public function setProperties( array $properties ): void;Replaces all application properties.
setProperty()
public function setProperty(
string $name,
mixed $value
): void;Sets a single application property.
setRedelivered()
public function setRedelivered( bool $redelivered ): void;Marks the message as redelivered.
setReplyTo()
public function setReplyTo( string $replyTo ): void;Sets the reply-to destination name.
setTimestamp()
public function setTimestamp( int $timestamp ): void;Sets the timestamp (in milliseconds).
Contracts\Queue\Processor
InterfaceSource on GitHubProcesses a single message. The return value tells the consumer what to do next: acknowledge, reject, or requeue.
The literal constant values are kept compatible with the wider interop ecosystem.
Phalcon\Contracts\Queue\Processor
Method Summary
Constants
stringACK = "enqueue.ack"stringREJECT = "enqueue.reject"stringREQUEUE = "enqueue.requeue"Methods
process()
public function process(
Message $message,
Context $context
): string|object;Processes the message and returns one of the ACK / REJECT / REQUEUE constants, or an object whose string form is one of those values.
Contracts\Queue\Producer
InterfaceSource on GitHubSends messages to a destination.
Phalcon\Contracts\Queue\Producer
Method Summary
publicint|nullgetDeliveryDelay()Returns the delivery delay (in milliseconds) or null when not set.publicint|nullgetPriority()Returns the message priority or null when not set.publicint|nullgetTimeToLive()Returns the time to live (in milliseconds) or null when not set.publicvoidsend(Destination$destination,Message$message)Sends a message to the given destination.publicProducersetDeliveryDelay( mixed$deliveryDelay = null )Sets the delivery delay (in milliseconds). Null clears it.publicProducersetPriority( mixed$priority = null )Sets the message priority. Null clears it.publicProducersetTimeToLive( mixed$timeToLive = null )Sets the time to live (in milliseconds). Null clears it.Methods
getDeliveryDelay()
public function getDeliveryDelay(): int|null;Returns the delivery delay (in milliseconds) or null when not set.
getPriority()
public function getPriority(): int|null;Returns the message priority or null when not set.
getTimeToLive()
public function getTimeToLive(): int|null;Returns the time to live (in milliseconds) or null when not set.
send()
public function send(
Destination $destination,
Message $message
): void;Sends a message to the given destination.
setDeliveryDelay()
public function setDeliveryDelay( mixed $deliveryDelay = null ): Producer;Sets the delivery delay (in milliseconds). Null clears it.
setPriority()
public function setPriority( mixed $priority = null ): Producer;Sets the message priority. Null clears it.
setTimeToLive()
public function setTimeToLive( mixed $timeToLive = null ): Producer;Sets the time to live (in milliseconds). Null clears it.
Contracts\Queue\Queue
InterfaceSource on GitHubA queue destination (point-to-point).
Phalcon\Contracts\Queue\DestinationPhalcon\Contracts\Queue\Queue
Method Summary
Methods
getQueueName()
public function getQueueName(): string;Returns the queue name.
Contracts\Queue\QueueTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Queue namespace.
Phalcon\Contracts\Queue\QueueTypes
Contracts\Queue\SubscriptionConsumer
InterfaceSource on GitHubConsumes from several queues at once, dispatching each message to the callback registered for its consumer.
Phalcon\Contracts\Queue\SubscriptionConsumer
Method Summary
publicvoidconsume( int$timeout = 0 )Starts consuming, blocking up to timeout milliseconds (0 = blockpublicvoidsubscribe(Consumer$consumer,callable$callback)Subscribes a consumer; the callback receives each delivered message.publicvoidunsubscribe( Consumer$consumer )Removes a previously subscribed consumer.publicvoidunsubscribeAll()Removes every subscribed consumer.Methods
consume()
public function consume( int $timeout = 0 ): void;Starts consuming, blocking up to timeout milliseconds (0 = block until a message is available).
subscribe()
public function subscribe(
Consumer $consumer,
callable $callback
): void;Subscribes a consumer; the callback receives each delivered message.
unsubscribe()
public function unsubscribe( Consumer $consumer ): void;Removes a previously subscribed consumer.
unsubscribeAll()
public function unsubscribeAll(): void;Removes every subscribed consumer.
Contracts\Queue\Topic
InterfaceSource on GitHubA topic destination (publish/subscribe).
Phalcon\Contracts\Queue\DestinationPhalcon\Contracts\Queue\Topic
Method Summary
Methods
getTopicName()
public function getTopicName(): string;Returns the topic name.
Contracts\Queue\VisibilityAware
InterfaceSource on GitHubMarker contract for a consumer that supports a visibility timeout
(for example Beanstalk TTR or an SQS visibility timeout). Callers detect
support with instanceof. It carries no behavior and commits to no class
shape.
Phalcon\Contracts\Queue\VisibilityAware
Contracts\Session\SessionTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Session namespace.
Phalcon\Contracts\Session\SessionTypes
Uses Phalcon\Storage\Serializer\SerializerInterface
Contracts\Storage\StorageTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Storage namespace.
Phalcon\Contracts\Storage\StorageTypes
Uses Phalcon\Storage\Serializer\SerializerInterface · WeakReference
Contracts\Support\Collection
InterfaceSource on GitHubCanonical contract for Phalcon\Support\Collection.
@extends ArrayAccess<int|string, mixed> @extends IteratorAggregate<int|string, mixed>
\ArrayAccessPhalcon\Contracts\Support\Collection- extends\ArrayAccess,\IteratorAggregate
Uses ArrayAccess · IteratorAggregate
Method Summary
publicmixed__get( string$element )publicbool__isset( string$element )publicvoid__set(string$element,mixed$value)publicvoid__unset( string$element )publicvoidclear()Clears the internal collection.publicarraycolumn( string$propertyOrMethod )Returns the values from a single property/method extracted from everypublicstaticeach( callable$callback )Invokes the callback for every item in the collection.publicstaticfilter( callable$callback )Returns a new collection of items for which the callback returns true.publicmixedfirst()Returns the first value in the collection or null when empty.publicmixedget(string$element,mixed$defaultValue = null,string|null$cast = null)Returns an element from the collection.publicarraygetKeys( bool$insensitive = true )Returns the keys (insensitive or not) of the collection.publicstring|nullgetType()Returns the configured runtime type guard, or null when not set.publicarraygetValues()Returns the values of the internal array.publicboolhas( string$element )Checks whether an element exists in the collection.publicvoidinit( array$data = [] )Initializes the internal array.publicboolisEmpty()Returns true when the collection has no entries.publicarraykeys( bool$insensitive = true )Returns the keys (insensitive or not) of the collection.publicmixedlast()Returns the last value in the collection or null when empty.publicstaticmap( callable$callback )Returns a new collection with the callback applied to every value.publicmixedreduce(callable$callback,mixed$initial = null)Reduces the collection to a single value using the callback.publicvoidremove( string$element )Removes the element from the collection.publicvoidreplace( array$data )Replaces the collection data with a new array, clearing first.publicvoidset(string$element,mixed$value)Stores an element in the collection.publicstaticsort(callable|null$callback = null,int$order = 4)Returns a new collection sorted by value, preserving keys.publicarraytoArray()Returns the collection as an array.publicstringtoJson( int$options = 4194383 )Returns the collection serialized as a JSON string.publicarrayvalues()Returns the values of the internal array.publicstaticwhere(string$propertyOrMethod,mixed$value)Returns a new collection containing only the items whoseMethods
__get()
public function __get( string $element ): mixed;__isset()
public function __isset( string $element ): bool;__set()
public function __set(
string $element,
mixed $value
): void;__unset()
public function __unset( string $element ): void;clear()
public function clear(): void;Clears the internal collection.
column()
public function column( string $propertyOrMethod ): array;Returns the values from a single property/method extracted from every item in the collection, keyed by the original collection key.
each()
public function each( callable $callback ): static;Invokes the callback for every item in the collection.
filter()
public function filter( callable $callback ): static;Returns a new collection of items for which the callback returns true.
first()
public function first(): mixed;Returns the first value in the collection or null when empty.
get()
public function get(
string $element,
mixed $defaultValue = null,
string|null $cast = null
): mixed;Returns an element from the collection.
getKeys()
public function getKeys( bool $insensitive = true ): array;Returns the keys (insensitive or not) of the collection.
getType()
public function getType(): string|null;Returns the configured runtime type guard, or null when not set.
getValues()
public function getValues(): array;Returns the values of the internal array.
has()
public function has( string $element ): bool;Checks whether an element exists in the collection.
init()
public function init( array $data = [] ): void;Initializes the internal array.
isEmpty()
public function isEmpty(): bool;Returns true when the collection has no entries.
keys()
public function keys( bool $insensitive = true ): array;Returns the keys (insensitive or not) of the collection.
last()
public function last(): mixed;Returns the last value in the collection or null when empty.
map()
public function map( callable $callback ): static;Returns a new collection with the callback applied to every value.
reduce()
public function reduce(
callable $callback,
mixed $initial = null
): mixed;Reduces the collection to a single value using the callback.
remove()
public function remove( string $element ): void;Removes the element from the collection.
replace()
public function replace( array $data ): void;Replaces the collection data with a new array, clearing first.
set()
public function set(
string $element,
mixed $value
): void;Stores an element in the collection.
sort()
public function sort(
callable|null $callback = null,
int $order = 4
): static;Returns a new collection sorted by value, preserving keys.
toArray()
public function toArray(): array;Returns the collection as an array.
toJson()
public function toJson( int $options = 4194383 ): string;Returns the collection serialized as a JSON string.
values()
public function values(): array;Returns the values of the internal array.
where()
public function where(
string $propertyOrMethod,
mixed $value
): static;Returns a new collection containing only the items whose
propertyOrMethod strictly equals $value.
Contracts\Support\Debug\Renderer
InterfaceSource on GitHubCanonical contract for Phalcon\Support\Debug renderers. Turns an ExceptionReport into output.
Phalcon\Contracts\Support\Debug\TemplateAwarePhalcon\Contracts\Support\Debug\Renderer
Uses Phalcon\Support\Debug\Report\ExceptionReport
Method Summary
publicstringgetCssSources( string$uri )Returns the CSS sources block for the given base URI.publicstringgetJsSources( string$uri )Returns the JavaScript sources block for the given base URI.publicstringgetVersion()Returns the framework version block.publicstringrender( ExceptionReport$report )Renders the report.Methods
getCssSources()
public function getCssSources( string $uri ): string;Returns the CSS sources block for the given base URI.
getJsSources()
public function getJsSources( string $uri ): string;Returns the JavaScript sources block for the given base URI.
getVersion()
public function getVersion(): string;Returns the framework version block.
render()
public function render( ExceptionReport $report ): string;Renders the report.
Contracts\Support\Debug\TemplateAware
InterfaceSource on GitHubCanonical contract for components that render through named, overridable template strings.
Phalcon\Contracts\Support\Debug\TemplateAware
Method Summary
publicstringgetTemplate( string$name )Returns the template for the given name (override if set, defaultpublicstaticsetTemplate(string$name,string$template)Overrides the template for the given name.Methods
getTemplate()
public function getTemplate( string $name ): string;Returns the template for the given name (override if set, default otherwise).
setTemplate()
public function setTemplate(
string $name,
string $template
): static;Overrides the template for the given name.
Contracts\Support\SupportTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Support namespace.
Phalcon\Contracts\Support\SupportTypes
Contracts\Translate\TranslateTypes
InterfaceSource on GitHubCentral registry of the array shapes used across the Translate namespace.
Phalcon\Contracts\Translate\TranslateTypes
Contracts\View\Renderer
InterfaceSource on GitHubRenders a template with the given data and returns the result as a string.
A neutral abstraction: it is not tied to MVC, to ADR, or to any particular
template engine. Phalcon\Mvc\View\Simple satisfies it out of the box, and
userland engines only need this one method to become a drop-in renderer.
Phalcon\Contracts\View\Renderer
Method Summary
Methods
render()
public function render(
string $path,
array $params = []
): string;Renders the template and returns the output.