lodev09/bootstrap-php

A highly extendable PHP library that generate and prints html for bootstrap.

1.1.13 2021-03-08 19:09 UTC

README

A highly extendable PHP library that generate and prints html for bootstrap.

Installation

$ composer require lodev09/bootstrap-php

Built-in Components

The library has built-in components that are already available for you to use. See creating custom components to learn more on how to create your own component.

  • Table - Print tables from datasource
  • Button - Print simple buttons
  • Select - Print select from datasource
  • Alert - Print alert
  • Input - Print input (text, password, etc)

If you want me to add your own component, feel free to contribute and submit a PR!

Usage

use \Bootstrap\Components\Table;

// somewhere in your project.
// sample data from your db
$data = [
    ['name' => 'Jovanni Lo', 'email' => 'lodev09@gmail.com'],
    ['name' => 'foo', 'email' => 'bar@email.com']
];

$table = new Table($data);
$table->cell = [
    'name' => [
        'class' => 'text-primary',
        'url' => '#docs',
        // ... so much more
    ],
    // can also be a closure
    'username' => function($row, $index, $value) {
        // print_r($row)
        return '<strong>@'.$row['username'].'</strong>';
    }
];

// print the html
$table->printHtml();

Feedback

All bugs, feature requests, pull requests, feedback, etc., are welcome. Visit my site at www.lodev09.com or LICENSE MIT

Credits

© 2018 - Coded by Jovanni Lo / @lodev09

License

Released under the LICENSE MIT See LICENSE file.