PHP code example of feffel / felfactory

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

    

feffel / felfactory example snippets


use felfactory\Annotation as FCT;

class AnnotatedModel
{
    /**
     * @FCT\Generate("firstName")
     */
    public $firstName;

    /**
     * @FCT\Value("""felfel""")
     */
    protected $lastName;

    /**
     * @FCT\ObjectOf(AddressModel::class)
     */
    public $address;

    /**
     * @FCT\ManyOf(@FCT\Generate("phoneNumber"), 1, 3)
     */
    public $phoneNos;
}

return [
    AnnotatedModel::class => [
        'firstName' => "generate('firstName')",
        'lastName'  => "value('\"felfel\"')",
        'address'   => "class(felfactory\models\AddressModel)",
        'phoneNos'  => "many(generate('phoneNumber'), 1, 3)"
    ],
];