PHP code example of piko / grid

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

    

piko / grid example snippets


use Piko\Grid;

$rows = [
    ['id' => 1, 'firstname' => 'John', 'lastname' => 'Lennon'],
    ['id' => 2, 'firstname' => 'Elvis', 'lastname' => 'Presley'],
    ['id' => 3, 'firstname' => 'Mick', 'lastname' => 'Jagger'],
];

$grid = new Grid([
    'baseRoute' => '/admin/users',
    'query' => $_GET,
    'countItems' => count($rows),
    'totalItems' => 100,
    'itemsPerPage' => 10,
    'currentPage' => (int)($_GET['page'] ?? 1),
    // optional: 'language' => 'fr',
]);

$grid = new Grid([
    // ...
    'language' => 'fr',
]);