PHP code example of guanhui07 / dto

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

    

guanhui07 / dto example snippets

 
composer 

namespace App\Services\Entity;
use Guanhui07\BaseDto;

class MsgGiftDto extends BaseDto
{

    /**
     * 礼物ID
     * @var int
     */
    public $id;

    /**
     * 礼物数量
     * @var int
     */
    public $number;
    
   /**
     * 礼物名
     * @var int
     */
    public $gift_name;

}


$giftDto = new MsgGiftDto([
    'id' => 1,
    'number' => 10,
    'gift_name' => 'test123',
])

$obj->send($giftDto);

$giftDto = new MsgGiftDto()->fill([
    'id' => 1,
    'number' => 10,
    'gift_name' => 'test123',
]);

$obj->send($giftDto);

$giftDto = new MsgGiftDto();
$giftDto->id = 1;
$giftDto->number = 10;
$giftDto->gift_name = 'test123';

$obj->send($giftDto);