PHP code example of jose-chan / entity-utils

1. Go to this page and download the library: Download jose-chan/entity-utils 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/ */

    

jose-chan / entity-utils example snippets




$data = [
    "a" => 1,
    "b" => "b",
    "c" => [
        "d" => 1.22,
        "e" => ""
    ],
    "d" => [
        [
            "f" => "f",
            "g" => 4
        ],
        [
            "f" => "f",
            "g" => 4
        ]
    ]
];

$entity = app(\JoseChan\Entity\Entity::class, ["data" => $data]);




class CEntity extends JoseChan\Entity\Entity{
    
}

class MyEntity extends \JoseChan\Entity\Entity {
    
    protected $arrayAttributeEntity = [
        "c" => CEntity::class
    ];
}



class MyCollection extends \Illuminate\Support\Collection{
    
}

class DEntity extends \JoseChan\Entity\Entity{
    
    protected static function collection(){
        return MyCollection::class;
    }
}


class MyValidateEntity extends \JoseChan\Entity\ValidateEntity{
    protected function rules(){
        return [
            "a" => "
    }
    
}