PHP code example of bag2 / doppel

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

    

bag2 / doppel example snippets




class Vehicle {
    public static function horn() {
        return 'Beep!';
    }
}

echo Vehicle::horn(), PHP_EOL; // Beep!

$doppel = (new Bag2\Doppel\Factory)->create();
$doppel->add('Vehicle::horn')->andReturn('Boo!');

echo Vehicle::horn(), PHP_EOL; // Boo!

$doppel->finalize();

echo Vehicle::horn(), PHP_EOL; // Beep!