Even if Composer it's the preferred method to generate the files needed to get all classes loaded, maybe you want to do the task by hand:
Handling namespaces
All BootHelp classes are under the namespace BootHelp. So, to use any class you need to use the Fully qualified class name. For example, to get a new instance of Modal class you need to use:
<?php
...
$modal = new BootHelp\Modal('Hello world');
...
However, as your project grows up using fully qualified class names becomes annoying, so it's better to use PHP USE sentence:
<?php
...
use BootHelp\Modal;
...
$modal = new Modal('Hello world)';
...
How to use BootHelp classes:
You have 2 ways to use BootHelp: Using BootHelp abstract class and then call any of its methods.
The other way is to get an instance of the component you want to use.
Method 1 - Using BootHelp abstract class:
<?php
use BootHelp\BootHelp;
...
$modal = BootHelp::modal('How easy is to use BootHelp!!!');
echo $modal;
...
BootHelp abstract class exposes the following 17 abstract methods:
content_tag, divider, horizontal, link_to, vertical, alert_box, button, button_group, button_toolbar, dropdown, icon, modal, nav, navbar, panel, panel_row, progress_bar
Method 2 - Using directly the component class:
<?php
use BootHelp\Modal;
...
$modal = new Modal('How easy is to use BootHelp!!!');
echo $modal;
BootHelp offers 17 classes that deal directly with Bootstrap components:
ContentTag, Divider, Horizontal, LinkTo, Vertical, AlertBox, Button, ButtonGroup, ButtonToolbar, Dropdown, Icon, Modal, Nav, Navbar, Panel, PanelRow, ProgressBar.
Besides the classes showed above, you can find 5 additionals classes with differents purposes:
Html, HtmlAttribute, HtmlContent, Base, BootHelp
BootHelp API
To get an idea about how to use BootHelp classes, what parameters you have to provide, what classes you can use together, and somethings like that, there is a complete guide included, that you can load in your browser. The guide is located in Guide folder. Actually, when you download BootHelp you can open the file index.php in your browser to read all the information about the classes.
However, to get running the Guide, you need to download and install the following:
-
[jQuery] 1.9.x
-
[Bootstrap] 3.3.4
Then, uncompress the files above downloaded and carefully follows the steps show below:
-
Get into BootHelp root folder.
-
Copy the file bootstrap.min.css into Guide/css folder.
-
Copy the files bootstrap/fonts/intoGuide/fonts* folder.
-
Copy the files bootstrap.min.js and jquery.min.js into Guide/js folder.
Aditional css is required to use 'Font awesome'. You have to add a link to awesome.css:
<link href="//netdna.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css" media="screen" rel="stylesheet" type="text/css" />
You have to put the sentence above in index.php
Todo
BootHelp is not perfect!!!. It's been tested but maybe you can find some bugs, or maybe you can find many better ways to do the things. For that reason, there are some things to do:
-
Include more Bootstrap components.
-
Find a way to integrate BootHelp with template engines like [Twig].
-
Improve the classes integration.
Author
[Jorge Cobis]
By the way, I'm from Bolivarian Republic of Venezuela :-D
Contributing
Feel free to contribute!!!. Welcome aboard!!!
Misc
Version history
0.4.0 (Tuesday, 12th May 2015)
-
Added support for badges, labels, images and thumbnails components.
-
Refactoring of few Base methods.
-
Guide updating.
-
Fix minor bugs.
0.3.2 (Friday, 1st May 2015)
-
Fix minor bug in progress bar label.
0.3.1 (Monday, 20th April 2015)
-
Adding full customizing options for modal button.
-
General namespace refactoring.
-
Guide bugs fixed.
-
Fix minor bugs.
0.3.0 (Thursday, 16th April 2015)
-
Adding support for generating Button Groups and Button Toolbars.
-
Improved documentation.
-
Fix minor bugs.
-
New tests for new compoments.
-
Updated test for Dropdown, Nav and Navbar components.
0.2.2 (Wednesday, 15th April 2015)
-
Better integration between Dropdown and Nav / Navbar.
-
Adding correct class when a Button is within a Navbar.
-
Fix minor bugs.
-
README.md upgraded.
0.2.1 (Friday, 10th April 2015)
-
Updating .gitignore file.
0.2.0 (Friday, 10th April 2015)
-
First public release.
-
Whole project refactored.
0.1.0 (Sunday, 21st September 2014)
-
Initial non public version (Classes based on traits)
License
Copyright (c) 2015 Jorge Cobis (<jcobis@gmail.com>)
MIT License
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
[modal]:http://getbootstrap.com/javascript/#modals
[phpunit]:https://phpunit.de/
[jQuery]:http://jquery.com
[bootstrap]:http://getbootstrap.com/
[bootstrap requirements]:http://getbootstrap.com/getting-started/
[composer]:https://getcomposer.org
[twig]:http://twig.sensiolabs.org/
[Jorge Cobis]:mailto:jcobis@gmail.com