PHP code example of themadhenchman / encoder-annotation

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

    

themadhenchman / encoder-annotation example snippets


#[DecodeClass(DataObject::class)]
#[EncodeClass(DataObject::class)]
class DataObject
{
    #[EncodeProperty('dataObjectValue')]
    #[DecodeToProperty('dataObjectValue')]
    public int $computedValue;

    public function __construct(int $computedValue = 0)
    {
        $this->computedValue = $computedValue;
    }
}

$instance = new DataObject(44);