PHP code example of icanboogie / common

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

    

icanboogie / common example snippets




use ICanBoogie\PropertyNotDefined;

class A
{
	private $id;

	public function __get(string $property)
	{
		if ($property === 'id') {
			return $this->id;
		}

		throw new PropertyNotDefined([ $property, $this ]);
	}
}



use ICanBoogie\ToArray;
use ICanBoogie\ToArrayRecursive;

class A implements ToArrayRecursive
{
	use ToArrayRecursiveTrait;

	public function to_array(): array
	{
		return (array) $this;
	}
}