PHP code example of intervention / helper

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

    

intervention / helper example snippets


// returns '24. Oktober 2003, 10:45' in german locale
return Date::format('datetime', '2003-10-24 10:45:13');

// returns 'October 24, 2003, 10:45 AM' in english locale
return Date::format('datetime', '2003-10-24 10:45:13');

// returns '10 Jahre' in german locale
return Date::age('2003-10-24 10:00', '2013-10-24 10:45:13');

// methods also takes unix timestamps of DateTime objects, second parameter is optional
return Date::age(1292177455);

// returns '4 cars'
return String::pluralize(4, 'car', 'cars');

// returns '1.200,00 EUR' in german locale
return String::formatMoney(1200, 'EUR');

// echoes different values repeated one after another
for ($i=0; $i < 10; $i++) { 
    echo String::alternator('one', 'two', 'three');
}

// you may also use arrays as input for alternator
for ($i=0; $i < 10; $i++) { 
    echo String::alternator(array('one', 'two', 'three'));
}