zyimm/php-pojo

There is no license information available for the latest version (0.0.5) of this package.

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

0.0.5 2024-03-06 08:45 UTC

This package is auto-updated.

Last update: 2024-04-06 08:59:48 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();