PHP code example of uni-method / json-to-php-class
1. Go to this page and download the library: Download uni-method/json-to-php-class 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/ */
uni-method / json-to-php-class example snippets
namespace App\Model;
class Root
{
protected int $count;
/**
* @var Same[]
*/
protected array $same;
public function getCount() : int
{
return $this->count;
}
public function setCount(int $count) : void
{
$this->count = $count;
}
/**
* @return Same[]
*/
public function getSame() : array
{
return $this->same;
}
/**
* @param Same[] $same
*/
public function setSame(array $same) : void
{
$this->same = $same;
}
}
namespace App\Model;
class Same
{
protected float $length;
protected Tag $tag;
public function getLength() : float
{
return $this->length;
}
public function setLength(float $length) : void
{
$this->length = $length;
}
public function getTag() : Tag
{
return $this->tag;
}
public function setTag(Tag $tag) : void
{
$this->tag = $tag;
}
}
namespace App\Model;
class Tag
{
protected string $name;
public function getName() : string
{
return $this->name;
}
public function setName(string $name) : void
{
$this->name = $name;
}
}
use Symfony\Component\Serializer\Annotation\SerializedName;
/**
* @SerializedName("reply_to_message")
*/
protected ReplyToMessage $replyToMessage;