Skip to content

kktuax/PHPStrap

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Whats the purpose of this project?

Using this library you can create Bootstrap's HTML markup easily using PHP.

Features

  • Bootstrap 3 support
  • Nest components in object-oriented way
  • Extend the bootstrap components with custom styles
  • Form validation
  • Wizard component with dependant Forms

Quick start

A full working example is available in the repository.

Add the composer dependency:

"require": {
   "phpstrap/phpstrap": "1.*"
}

Issue a composer install o composer update if you already have composer installed for your project.

Include de composer autoload directive:

require_once __DIR__ . '/vendor/autoload.php';

Include Bootstrap's CSS+JS in your PHP, for example with the CDN:

<head>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css" >
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css" >
	<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>

And start producing the HTML markup:

use PHPStrap\Panel;
$ExamplePanel = new Panel();
$ExamplePanel->addHeader("Example panel");
$ExamplePanel->addContent("My content");
echo $ExamplePanel;

Clone and run example

git clone https://github.com/kktuax/PHPStrap.git
cd PHPStrap/examples
composer install

Deploy the examples folder to your PHP-enabled server, an open your browser:

http://localhost/PHPStrap/examples/example.php

API DOCS