PHP code example of neuron-php / formatting

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

    

neuron-php / formatting example snippets


public function format( string $data ): ?string;

use Neuron\Formatters\Currency;

$Formatter = new Currency();
echo $Formatter->format( 5 );

$Formatter = new Currency();
$Formatter->setPadLength( 6 );
echo $Formatter->format( 5 );

$Formatter = new Currency();

echo $Formatter
	->setCurrencySymbol( '£' )
	->setPadLength( 11 )
	->setPadCharacter( '-' )
	->format( 5 );

use Neuron\Formatters\Date;

$Formatter = new Date();
echo $Formatter->format( '12/23/2024' );

$Formatter = new Date();
$Formatter->setFormat( 'd/m/Y' );
echo $Formatter->format( '12/23/2024' );

use Neuron\Formatters\DateTime;

$Formatter = new DateTime();
echo $Formatter->format( '12/23/2024 13:30' );

$Formatter = new DateTime();
$Formatter->setFormat( 'd/m/Y H:i' );
echo $Formatter->format( '12/23/2024 13:30' );

use Neuron\Formatters\Time;

$Formatter = new Time();
echo $Formatter->format( '13:30' );

$Formatter = new Time();
$Formatter->setFormat( 'H:i:s' );
echo $Formatter->format( '13:30:40' );

use Neuron\Formatters\PhoneNumber;

$Formatter = new PhoneNumber();

echo $Formatter->format( '1234567890' );       // 123-456-7890
echo $Formatter->format( '(123) 456-7890' );   // 123-456-7890
echo $Formatter->format( '1234567' );          // 123-4567
echo $Formatter->format( '123456789012' );     // +12 34 567 89012
bash
composer 

£-------5.00