Events
Events are objects dispatched at various stages of the build process. You can listen to these events and respond with custom actions as needed.
All event classes are namespaced under Kenjiefx\ScratchPHP\App\Events
.
PageBuildStartedEvent
Dispatched as soon as the page build process is started. Has 2 public methods:
getName(): string
- returns the name of the pagegetPageModel(): PageModel
- returns data about the page
HTMLBuildCompletedEvent
Dispatched as soon as the page completed building the html. Has 4 public methods:
getName(): string
- returns the name of the pagegetPage(): PageModel
- returns data about the pagegetContent(): string
- returns the rendered page html contentupdateContent(string $content): void
- updates the html content
CSSBuildCompletedEvent
Dispatched as soon as the page completed building the css. Has 4 public methods:
getName(): string
- returns the name of the pagegetPage(): PageModel
- returns data about the pagegetContent(): string
- returns the rendered page css contentupdateContent(string $content): void
- updates the css content
JSBuildCompletedEvent
Dispatched as soon as the page completed building the javascript. Has 4 public methods:
getName(): string
- returns the name of the pagegetPage(): PageModel
- returns data about the pagegetContent(): string
- returns the rendered page js contentupdateContent(string $content): void
- updates the js content
ComponetHTMLCollectedEvent
Dispatched after the the component HTML is rendered. Has 6 methods:
getName(): string
- returns the name of the ComponentgetComponent(): ComponentModel
- returns data about the ComponentgetContent(): string
- returns the rendered component contentgetComponentDir(): string
- returns the directory location of the componentupdateContent(string $content): void
- updates the content of the ComponentgetData(): array
- returns the data passed to the component
ComponentCSSCollectedEvent
Dispatched after component CSS is retrieved. Has 5 methods:
getName(): string
- returns the name of the ComponentgetComponent(): ComponentModel
- returns data about the ComponentgetContent(): string
- returns the rendered component contentgetComponentDir(): string
- returns the directory location of the componentupdateContent(string $content): void
- updates the content of the Component
ComponentJSCollectedEvent
Dispatched after component CSS is retrieved. Has 5 methods:
getName(): string
- returns the name of the ComponentgetComponent(): ComponentModel
- returns data about the ComponentgetContent(): string
- returns the rendered component contentgetComponentDir(): string
- returns the directory location of the componentupdateContent(string $content): void
- updates the content of the Component
BlockCSSCollectedEvent
Dispatched after block CSS is retrieved. Has 5 methods:
getName(): string
- returns the name of the BlockgetBlock(): BlockModel
- returns data about the BlockgetContent(): string
- returns the rendered block contentgetgetBlockDir(): string
- returns the directory location of the blockupdateContent(string $content): void
- updates the content of the block
BlockJSCollectedEvent
Dispatched after block CSS is retrieved. Has 5 methods:
getName(): string
- returns the name of the BlockgetBlock(): BlockModel
- returns data about the BlockgetContent(): string
- returns the rendered block contentgetBlockDir(): string
- returns the directory location of the blockupdateContent(string $content): void
- updates the content of the block