PHP code example of mcustiel / typed-php

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

    

mcustiel / typed-php example snippets


interface Primitive
{
    /**
     * @return mixed
     */
    public function value();
}

use Mcustiel\TypedPhp\ValueObjects\Multiple\ObjectsArray;

class Foo 
{
    private function bar()
    {
        echo 'I am Bar';
    }
}

class FooArray extends ObjectsArray
{
    public function __construct(array $array)
    {
        parent::__construct(Foo::class, $array);
    }
}

use Mcustiel\TypedPhp\Values\IntegerCreator;

$a = IntegerCreator::instance()->getValueObject(5);
$b = IntegerCreator::instance()->getValueObject(5);

json
""mcustiel/typed-php": "*"
}