PHP Mapping for Local Classes

On this page:

Mapped PHP Class

A local Slice class is mapped to a PHP class with the same name. For example:

Slice
module M
{
    local class Example
    {
        ...
    }
}

is mapped to the PHP class Example:

PHP
namespace M
{
    class Example
    {
        ...
    }
}

LocalObject in PHP

Like local interfaces, local Slice classes implicitly derive from LocalObject, which is mapped to the native stdClass class in PHP.

Mapping for Local Interface Inheritance in PHP

A local Slice class can extend another local Slice class, and can implement one or more local Slice interfaces. extends and implements map to the same constructs in PHP. For example:

Slice
module M
{
    local interface A {}
    local interface B {}
    
    local class C implements A, B {}
    local class D extends C {}
}

is mapped to:

PHP
namespace M
{
    interface A
    {
        ...
    }
    interface B
    {
        ...
    }
    class C implements A, B
    {
        ...
    }
    class D extends C
    {
        ...
    }
}