PHP code example of behzadsp / php-raid

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

    

behzadsp / php-raid example snippets


use behzadsp\Raid\Drive;
use behzadsp\Raid\RaidTen;
use behzadsp\Raid\RaidZero;

$drives = [
    new Drive('1TB', 'ssd', '61cf6218-f378-4c7b-8b81-c09e84a1a86f'),
    new Drive('1TB', 'ssd', 'c76bee9a-dce6-433c-acc3-b82947335dd2'),
    new Drive('1TB', 'ssd', '31125db2-6043-4955-818a-af9d259905eb'),
    new Drive('1TB', 'ssd', '302db7a1-bb2c-4fb9-a9e1-30636e8f312c'),
];

$raidTen = new RaidTen($drives);

echo $raidTen->getCapacity(); // 2199023255552
echo $raidTen->getCapacity(['human' => true]); // 2 TB

$raidZero = new RaidZero($drives);
echo $raidZero->getCapacity(); // 4398046511104
echo $raidZero->getCapacity(['human' => true]); // 4 TB