Flash\AbstractFlash 
-
Namespace
Phalcon\Flash
-
Uses
Phalcon\Di\AbstractInjectionAwarePhalcon\Di\DiPhalcon\Di\DiInterfacePhalcon\Html\Escaper\EscaperInterfacePhalcon\Session\ManagerInterfacePhalcon\Helper\Str\Interpolate
-
Extends
AbstractInjectionAware -
Implements
FlashInterface
Shows HTML notifications related to different circumstances. Classes can be stylized using CSS
$flash->success("The record was successfully deleted");
$flash->error("Cannot open the file");Properties
/**
* @var bool
*/
protected $autoescape = true;
/**
* @var bool
*/
protected $automaticHtml = true;
/**
* @var array
*/
protected $cssClasses;
/**
* @var string
*/
protected $customTemplate = '';
/**
* @var EscaperInterface | null
*/
protected $escaperService;
/**
* @var bool
*/
protected $implicitFlush = true;
/**
* @var array
*/
protected $messages;
/**
* @var SessionInterface | null
*/
protected $sessionService;Methods
public function __construct( EscaperInterface $escaper = null, SessionInterface $session = null );Phalcon\Flash constructor
public function clear(): void;Clears accumulated messages when implicit flush is disabled
public function error( string $message ): string | null;Shows a HTML error message
$flash->error("This is an error");public function getAutoescape(): bool;public function getCssClasses(): array;public function getCustomTemplate(): string;public function getEscaperService(): EscaperInterface;Returns the Escaper Service
public function notice( string $message ): string | null;Shows a HTML notice/information message
$flash->notice("This is an information");public function outputMessage( string $type, mixed $message );Outputs a message formatting it with HTML
$flash->outputMessage("error", $message);public function setAutoescape( bool $autoescape ): FlashInterface;Set the autoescape mode in generated HTML
public function setAutomaticHtml( bool $automaticHtml ): FlashInterface;Set if the output must be implicitly formatted with HTML
public function setCssClasses( array $cssClasses ): FlashInterface;Set an array with CSS classes to format the messages
public function setCustomTemplate( string $customTemplate ): FlashInterface;Set an custom template for showing the messages
public function setEscaperService( EscaperInterface $escaperService ): FlashInterface;Sets the Escaper Service
public function setImplicitFlush( bool $implicitFlush ): FlashInterface;Set whether the output must be implicitly flushed to the output or returned as string
public function success( string $message ): string | null;Shows a HTML success message
$flash->success("The process was finished successfully");public function warning( string $message ): string | null;Shows a HTML warning message
$flash->warning("Hey, this is important");Flash\Direct
-
Namespace
Phalcon\Flash
-
Uses
-
Extends
AbstractFlash -
Implements
Class Direct
@package Phalcon\Flash
Methods
public function message( string $type, mixed $message ): string | null;Outputs a message
public function output( bool $remove = bool ): void;Prints the messages accumulated in the flasher
Flash\Exception
-
Namespace
Phalcon\Flash
-
Uses
-
Extends
\Exception -
Implements
Exceptions thrown in Phalcon\Flash classes will use this class
Flash\FlashInterface 
-
Namespace
Phalcon\Flash
-
Uses
-
Extends
-
Implements
Interface FlashInterface
Interface for Phalcon\Flash classes
Methods
public function error( string $message ): string | null;Shows a HTML error message
public function message( string $type, string $message ): string | null;Outputs a message
public function notice( string $message ): string | null;Shows a HTML notice/information message
public function success( string $message ): string | null;Shows a HTML success message
public function warning( string $message ): string | null;Shows a HTML warning message
Flash\Session
-
Namespace
Phalcon\Flash
-
Uses
Phalcon\Session\ManagerInterface
-
Extends
AbstractFlash -
Implements
This is an implementation of the Phalcon\Flash\FlashInterface that temporarily stores the messages in session, then messages can be printed in the next request.
Methods
public function clear(): void;Clear messages in the session messenger
public function getMessages( mixed $type = null, bool $remove = bool ): array;Returns the messages in the session flasher
public function getSessionService(): ManagerInterface;Returns the Session Service
public function has( mixed $type = null ): bool;Checks whether there are messages
public function message( string $type, string $message ): string | null;Adds a message to the session flasher
public function output( bool $remove = bool ): void;Prints the messages in the session flasher
protected function getSessionMessages( bool $remove, mixed $type = null ): array;Returns the messages stored in session
protected function setSessionMessages( array $messages ): array;Stores the messages in session