PHP code example of kyimyohan / php-design-patterns

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

    

kyimyohan / php-design-patterns example snippets




use Kyimyohan\PhpDesignPatterns\DecoratorPattern\Decorator;
use Kyimyohan\PhpDesignPatterns\DecoratorPattern\BubbleTea;
use Kyimyohan\PhpDesignPatterns\DecoratorPattern\Jelly;
use Kyimyohan\PhpDesignPatterns\DecoratorPattern\Pudding;


$decorator = new Decorator(new Pudding(new Jelly(new BubbleTea)));
echo $decorator->getDescription();
echo $decorator->getPrice();
bash
composer