PHP code example of bcc / extra-tools-bundle

1. Go to this page and download the library: Download bcc/extra-tools-bundle 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/ */

    

bcc / extra-tools-bundle example snippets

 php


    // app/autoload.php
    $loader->registerNamespaces(array(
        'BCC' => __DIR__.'/../vendor/bundles',
        // your other namespaces
    ));
 php


    // app/AppKernel.php
    public function registerBundles()
    {
        return array(
            // ...
            new BCC\ExtraToolsBundle\BCCExtraToolsBundle(),
            // ...
        );
    }
 php


$dateFormatter = $container->get('bcc_extra_tools.date_formatter');

 php


$date = $dateFormatter->parse('November 1, 2011', 'en'); // obtains a datetime instance

 php


echo $dateFormatter->format($date, 'long', 'none', 'fr'); // echoes : "1 novembre 2011"

 php


$unitConverter = $container->get('bcc_extra_tools.unit_converter');

 php


echo $unitConverter->parse(1000, 'm', 'km'); // echoes : 1

 php


echo $unitConverter->parse('1h', 'm'); // echoes : 60