Version: v0.7.1 - Beta.  We welcome contributors & feedback.

Php.new

Php.new($phpClassName, $arg1, $arg2, ...) -> object

Description

Instantiate a PHP class.

For convenience, you can use forward slashes in place of backslashes for namespace separators.

$obj = Php.new('vendorLibrary/SomeClass', 123)

$obj.doSomething()

The object will be returned in a wrapper object for compatibility with THT.

It contains some additional methods to help work around any inconsistencies, such as naming conventions that don’t work with THT.

$className = 'vendorLibrary/SomeClass'
Php.require($className ~ '.php')

$obj = Php.new($className)

$obj.zGet('SOME_CONSTANT')  //= e.g. 123

See Also