Anatomy of a component
Magewire components are PHP classes inheriting from
By convention, Magewire component classes reside inside a Magento module within a
Magewire component classes can implement hook methods. If such a method exist on a component, it will be called at the appropriate time.
Two of the most used hook methods are
mount(), which is called once when the page is initially rendered, and
booted(), which is called on the initial preceding page request and all subsequent requests.
More information about available lifecycle hook methods can be found in the component Lifecycle hook methods page.
Magewire is aware of all public properties and methods on
magewire a view model.
Reserved Property Names
There are a couple of reserved properties that are declared by the abstract view model and can not be used for custom code, like
Because these are common property names, it is easy to declare a conflicting property with the same name in a child class. Doing so breaks Magewire.
Choose alternative property names instead, for example
$productName instead of
Some of theses properties are public, some are protected - in either case, do not use them for custom purposes in your own Magewire components!
Some may be used as internal implementation details, some are intended to be used by custom components for specific purposes.
At the time of writing, the following properties are used by Magewire: