PHP code example of zyimm / php-pojo

1. Go to this page and download the library: Download zyimm/php-pojo 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/ */

    

zyimm / php-pojo example snippets


class DemoDto extends \Zyimm\Pojo\Pojo
{
    protected $id;
    
    protected $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();



shell
composer