Skip to content

Binding objects

Greg Bowler edited this page Jan 27, 2023 · 14 revisions

// Most basic data structure: associative array. Key value pairs.

// Objects can be used instead of associative arrays, but plain objects don't bring any benefits.

// What's useful is to use instances of your project's classes. With the right application design, many steps can be avoided between the data coming from a database to being bound to the page.

Objects with public properties

// StdClass is an object with public properties.

// Binding an instance of a User with public readonly properties.

Using object functions to bind to the document.

// #[Bind("bindProperty")] attribute

// #[BindGetter] attribute for automatic


Next, learn how to template pages using Partial HTML.