PHP code example of ligne / xls-generator

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

    

ligne / xls-generator example snippets


$array = array(
    0 =>
    array(
        'id' => 1,
        'name' => 'Leanne Graham',
        'username' => 'Bret',
        'email' => '[email protected]',
        'phone' => '1-770-736-8031 x56442',
        'website' => 'hildegard.org',
    ),
    1 =>
    array(
        'id' => 2,
        'name' => 'Ervin Howell',
        'username' => 'Antonette',
        'email' => '[email protected]',
        'phone' => '010-692-6593 x09125',
        'website' => 'anastasia.net',
    ),
    2 =>
    array(
        'id' => 3,
        'name' => 'Clementine Bauch',
        'username' => 'Samantha',
        'email' => '[email protected]',
        'phone' => '1-463-123-4447',
        'website' => 'ramiro.info',
    ),
    3 =>
    array(
        'id' => 4,
        'name' => 'Patricia Lebsack',
        'username' => 'Karianne',
        'email' => '[email protected]',
        'phone' => '493-170-9623 x156',
        'website' => 'kale.biz',
    ),
    4 =>
    array(
        'id' => 5,
        'name' => 'Chelsey Dietrich',
        'username' => 'Kamren',
        'email' => '[email protected]',
        'phone' => '(254)954-1289',
        'website' => 'demarco.info',
    ),
    5 =>
    array(
        'id' => 6,
        'name' => 'Mrs. Dennis Schulist',
        'username' => 'Leopoldo_Corkery',
        'email' => '[email protected]',
        'phone' => '1-477-935-8478 x6430',
        'website' => 'ola.org',
    )
);

use Ligne\XlsGenerator;
//...
$xls = new XlsGenerator($array);
 var_dump($xls->getXls());

$xls = new XlsGenerator($array,['phone'],false,true);
var_dump($xls->getXls());