PHP code example of jimbo2150 / php-utilities

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

    

jimbo2150 / php-utilities example snippets


use Jimbo2150\PhpUtilities\Traitable;

trait resourceful {

}

trait streamable {
	// ...
}

trait writeable {
	use resourceful;
	use streamable;
	// ...
}

trait readable {
	use resourceful;
	use streamable;
	// ...
}

trait blankable {

}

class StringBuffer {
	use Traitable;
	use writeable;
	use readable;
	// ...
}

$string_stream = new StringBuffer();
$string_stream->hasTrait(resourceful::class); // true
$string_stream->hasTrait(readable::class); // true
$string_stream->hasTrait(blankable::class); // false

use Jimbo2150\PhpUtilities\Traits;

$string_stream = new StringBuffer();
Traits::instanceOf($string_stream, resourceful::class); // true
Traits::instanceOf($string_stream, readable::class); // true
Traits::instanceOf($string_stream, blankable::class); // false
bash
composer