zyimm/php-pojo

此包的最新版本(0.0.5)没有可用的许可证信息。

将PHP数据转换为Java的pojo工具

0.0.5 2024-03-06 08:45 UTC

This package is auto-updated.

Last update: 2024-09-06 09:49:49 UTC


README

安装

composer  require zyimm/php-pojo

使用示例

class DemoDto extends \Zyimm\Pojo\Pojo
{
    protected $idprotected $name;
    
    /**
     * @return mixed
     */
     public  function getId()
     {
        return $this->id;
     }
     
      public  function setId(int $id)
     {
        $this->id = $id;
     }
    
    /**
     * @return string
     */
     public  function getName():string
     {
        return $this->name;
     }
     
     public  function setName(string $name)
     {
         $this->name = $name;
     }

}


$dto = new DemoBto([
    'id' => 1
    'name' => 'name'
])

echo $dto['id']; // 1  or  $dto->getId();