PHP code example of joomla / compat
1. Go to this page and download the library: Download joomla/compat 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/ */
joomla / compat example snippets
class MyClass implements \JsonSerializable
{
/**
* @var array Holds the data this class uses.
*/
protected $data;
public function __construct(array $data)
{
$this->data = $data;
}
public function jsonSerialize()
{
return $this->data;
}
}
$obj = new MyClass(array('sample', 'data', 'to', 'encode'));
$encoded = json_encode($obj->jsonSerialize());