PHP code example of zero-to-prod / transformable

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

    

zero-to-prod / transformable example snippets


use Zerotoprod\Transformable\Transformable;

class YourDataModel
{
    use Transformable;

    public $name;
    public $email;
}

$model = new YourDataModel();
$model->name = 'John Doe';
$model->email = '[email protected]';

$array = $model->toArray();
$json = $model->toJson();