PHP code example of henrik / component

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

    

henrik / component example snippets


use Henrik\Component\Component;


    private int $x;

    /**
     * @return int
     */
    public function getX(): int
    {
        return $this->x;
    }

    /**
     * @param int $x
     */
    public function setX(int $x): void
    {
        $this->x = $x;
    }
}

$simple = new Simple();
$simple->x = 45;  //accessing the private property of `Simple` class by getter and setter
echo $simple->x;