We can't find the internet
Attempting to reconnect
Something went wrong!
Hang in there while we get back on track
Make me a JS Object Model - Milko Kosturkov - PHP UK 2022
Make PHP objects behave like JavaScript objects with JavaScript-inspired classes and syntax. Learn how to create constructors, implement inheritance, and use closures to create objects with methods.
- Make PHP objects behave like JavaScript objects
- Create a JSConstructor class that can act like a JavaScript constructor
-
Use
new
keyword to create objects -
prototype
property to inherit behavior - Implement inheritance between objects
- Use closures to create objects with a constructor
-
Create a magic
invoke
method to call functions on objects -
Implement a
magic get
method to get properties on objects -
Use
this
reference to call functions in the context of the object -
Create a
JSObject
class that extends theJSConstructor
class -
Implement a
callable
property to create objects that can be called like functions -
Implement inheritance between objects using the
prototype
chain -
Use the
new
keyword to create objects with a constructor -
Implement a
constructor
property to create objects with a constructor -
Use the
magic call
method to call functions on objects -
Implement a
get
andset
method to get and set properties on objects -
Use the
this
reference to call functions in the context of the object -
Implement a
callable
property to create objects that can be called like functions -
Implement inheritance between objects using the
prototype
chain