PHP code example of cambis / silverstripe-classnames

1. Go to this page and download the library: Download cambis/silverstripe-classnames library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cambis / silverstripe-classnames example snippets




use JsonSerializable;
use SilverStripe\ORM\DataObject;

class MyObject extends DataObject implements JsonSerializable
{
    public function getClassnames(): string
    {
        return json_encode($this);
    }

    public function jsonSerialize(): mixed
    {
        return [
            ['foo' => true],
            'bar',
        ];
    }
}