Contracts\Auth\Access\Access
InterfaceSource on GitHubPhalcon\Contracts\Auth\Access\Access
Method Summary
publicboolallowedIf()publicarraygetExceptActions()publicarraygetOnlyActions()publicboolisAllowed( string$actionName )publicarray|nullredirectTo()publicvoidsetExceptActions( array$exceptActions = [] )publicvoidsetOnlyActions( array$onlyActions = [] )Methods
allowedIf()
public function allowedIf(): bool;getExceptActions()
public function getExceptActions(): array;getOnlyActions()
public function getOnlyActions(): array;isAllowed()
public function isAllowed( string $actionName ): bool;redirectTo()
public function redirectTo(): array|null;setExceptActions()
public function setExceptActions( array $exceptActions = [] ): void;setOnlyActions()
public function setOnlyActions( array $onlyActions = [] ): void;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$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 $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$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 $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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been influenced by sinbadxiii/cphalcon-auth @link https://github.com/sinbadxiii/cphalcon-auth
Phalcon\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
Method Summary
publicboolcheck()Whether the current request is authenticated.publicstaticfromOptions(Adapter$adapter,Collection$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,
Collection $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.
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)publicfalse|AuthUserloginById(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
): false|AuthUser;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 )publicselfaddAccessList( 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()publicarraygetAccessList()publicGuard|nullgetDefaultGuard()publicarraygetGuards()publicGuardguard( string$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;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;getAccessList()
public function getAccessList(): array;getDefaultGuard()
public function getDefaultGuard(): Guard|null;getGuards()
public function getGuards(): array;guard()
public function guard( string $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\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
ThrowablePhalcon\Contracts\Container\Resolver\ResolverThrowable
Uses Throwable
Contracts\Container\Service\Collection
InterfaceSource on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\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\Provider
InterfaceSource on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
Phalcon\Contracts\Container\Service\Provider
Method Summary
Methods
provide()
public function provide( Collection $services ): void;Contracts\Container\Service\Throwable
InterfaceSource on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Implementation of this file has been heavily influenced by CapsulePHP. Additionally, there are implementations from ioc-interop, which is a Composer dependency, and from service-interop and resolver-interop. They are copied and re-implemented here because we need to support PHP 8.1. Once we move to min 8.4 and packages become available and compatible, the copies will be replaced with the actual Composer dependencies.
@link https://github.com/capsulephp/di @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md
@link https://github.com/ioc-interop/interface @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/service-interop/interface @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md
@link https://github.com/resolver-interop/interface/tree/1.x @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md
PhpThrowablePhalcon\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$schemaName = null)Creates a viewpublicbooldelete(mixed$table,string$whereCondition = null,array$placeholders = [],array$dataTypes = [])Deletes data from a table using custom RDBMS SQL syntaxpublicColumnInterface[]describeColumns(string$table,string$schema = null)Returns an array of Phalcon\Db\Column objects describing a tablepublicIndexInterface[]describeIndexes(string$table,string$schema = null)Lists table indexespublicReferenceInterface[]describeReferences(string$table,string$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$schemaName = null,bool$ifExists = true)Drops a table from a schema/databasepublicbooldropView(string$viewName,string$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$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$schemaName = null )List all tables on a databasepublicarraylistViews( string$schemaName = null )List all views on a databasepublicboolmodifyColumn(string$tableName,string$schemaName,ColumnInterface$column,ColumnInterface$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$schemaName = null)Generates SQL checking for the existence of a schema.tablepublicarraytableOptions(string$tableName,string$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$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 $schemaName = null
): bool;Creates a view
delete()
public function delete(
mixed $table,
string $whereCondition = null,
array $placeholders = [],
array $dataTypes = []
): bool;Deletes data from a table using custom RDBMS SQL syntax
describeColumns()
public function describeColumns(
string $table,
string $schema = null
): ColumnInterface[];Returns an array of Phalcon\Db\Column objects describing a table
describeIndexes()
public function describeIndexes(
string $table,
string $schema = null
): IndexInterface[];Lists table indexes
describeReferences()
public function describeReferences(
string $table,
string $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 $schemaName = null,
bool $ifExists = true
): bool;Drops a table from a schema/database
dropView()
public function dropView(
string $viewName,
string $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 robots
$robotsCount = $connection->fetchColumn("SELECT COUNT(*) FROM robots");
print_r($robotsCount);
// Getting name of last edited robot
$robot = $connection->fetchColumn(
"SELECT id, name FROM robots ORDER BY modified DESC",
1
);
print_r($robot);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 robot with a valid default value for the column 'year'
$success = $connection->insert(
"robots",
[
"Astro Boy",
$connection->getDefaultValue()
],
[
"name",
"year",
]
);@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 robot
$success = $connection->insertAsDict(
"robots",
[
"name" => "Astro Boy",
"year" => 1952,
]
);
// Next SQL sentence is sent to the database system
INSERT INTO `robots` (`name`, `year`) VALUES ("Astro boy", 1952);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 $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 $schemaName = null ): array;List all tables on a database
listViews()
public function listViews( string $schemaName = null ): array;List all views on a database
modifyColumn()
public function modifyColumn(
string $tableName,
string $schemaName,
ColumnInterface $column,
ColumnInterface $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
@deprecated Will re removed in the next version
tableExists()
public function tableExists(
string $tableName,
string $schemaName = null
): bool;Generates SQL checking for the existence of a schema.table
tableOptions()
public function tableOptions(
string $tableName,
string $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 robot
$success = $connection->updateAsDict(
"robots",
[
"name" => "New Astro Boy",
],
"id = 101"
);
// Next SQL sentence is sent to the database system
UPDATE `robots` SET `name` = "Astro boy" WHERE 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 $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$schemaName = null)Generates SQL to create a viewpublicstringdescribeColumns(string$table,string$schema = null)Generates SQL to describe a tablepublicstringdescribeIndexes(string$table,string$schema = null)Generates SQL to query indexes on a tablepublicstringdescribeReferences(string$table,string$schema = null)Generates SQL to query foreign keys on a tablepublicstringdropColumn(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$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$escapeChar = null,array$bindCounts = [])Transforms an intermediate representation for an expression into apublicstringlimit(string$sqlQuery,mixed$number)Generates the SQL for LIMIT clausepublicstringlistTables( string$schemaName = null )List all tables in databasepublicstringmodifyColumn(string$tableName,string$schemaName,ColumnInterface$column,ColumnInterface$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$schemaName = null)Generates SQL checking for the existence of a schema.tablepublicstringtableOptions(string$table,string$schema = null)Generates the SQL to describe the table creation optionspublicstringviewExists(string$viewName,string$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 $schemaName = null
): string;Generates SQL to create a view
describeColumns()
public function describeColumns(
string $table,
string $schema = null
): string;Generates SQL to describe a table
describeIndexes()
public function describeIndexes(
string $table,
string $schema = null
): string;Generates SQL to query indexes on a table
describeReferences()
public function describeReferences(
string $table,
string $schema = null
): string;Generates SQL to query foreign keys on a table
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 $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 $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 $schemaName = null ): string;List all tables in database
modifyColumn()
public function modifyColumn(
string $tableName,
string $schemaName,
ColumnInterface $column,
ColumnInterface $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 $schemaName = null
): string;Generates SQL checking for the existence of a schema.table
tableOptions()
public function tableOptions(
string $table,
string $schema = null
): string;Generates the SQL to describe the table creation options
viewExists()
public function viewExists(
string $viewName,
string $schemaName = null
): string;Generates SQL checking for the existence of a schema.view
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\Encryption\Security\CryptoUtils
InterfaceSource on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Phalcon\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Phalcon\Contracts\Encryption\Security\CsrfProtection
Method Summary
publicboolcheckToken(string$tokenKey = null,mixed$tokenValue = null,bool$destroyIfValid = true)publicSecuritydestroyToken()publicstring|nullgetRequestToken()publicstring|nullgetSessionToken()publicstring|nullgetToken()publicstring|nullgetTokenKey()Methods
checkToken()
public function checkToken(
string $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\PasswordSecurity
InterfaceSource on GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Phalcon\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 GitHubThis file is part of the Phalcon Framework.
(c) Phalcon Team <[email protected]>
For the full copyright and license information, please view the LICENSE.txt file that was distributed with this source code.
Phalcon\Contracts\Encryption\Security\CryptoUtilsPhalcon\Contracts\Encryption\Security\Security— extendsPhalcon\Contracts\Encryption\Security\CryptoUtils,Phalcon\Contracts\Encryption\Security\CsrfProtection,Phalcon\Contracts\Encryption\Security\PasswordSecurity
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$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 $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\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\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\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
Uses Phalcon\Paginator\Adapter\AdapterInterface
Method Summary
publicintgetLimit()Get current rows limitpublicRepositorypaginate()Returns a slice of the resultset to show in the paginationpublicAdapterInterfacesetCurrentPage( int$page )Set the current page numberpublicAdapterInterfacesetLimit( 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 ): AdapterInterface;Set the current page number
setLimit()
public function setLimit( int $limit ): AdapterInterface;Set current rows limit
Contracts\Paginator\Repository
InterfaceSource on GitHubInterface for the repository of current state Phalcon\Paginator\AdapterInterface::paginate()
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
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
getLimit()
public function getLimit(): int;Gets current rows limit
getNext()
public function getNext(): int;Gets number of the next page
getPrevious()
public function getPrevious(): int;Gets number of the previous page
getTotalItems()
public function getTotalItems(): int;Gets the total number of items
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\Support\Collection
InterfaceSource on GitHubCanonical contract for Phalcon\Support\Collection.
@extends ArrayAccess<int|string, mixed> @extends IteratorAggregate<int|string, mixed>
ArrayAccessPhalcon\Contracts\Support\Collection— extendsArrayAccess,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$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$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 $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.
@deprecated Use {@see self::keys()} instead. Will be removed in a future major release.
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.
@deprecated Use {@see self::values()} instead. Will be removed in a future major release.
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 $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.