Skip to content
Switch branches/tags
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time


A very simple framework for simple websites, such as URL shorteners.


Boggins aims to provide a few useful helper classes, basic routing and MVC functionality, all of which are opt-in rather than forcing any particular style or conventions. Modules are designed to be as independent as possible, so that you can delete any parts you don't want, if you like.


The directory structure is as follows:

- bootstrap
  - bootstrap.php     If you are using the MVC functionality, load in or define routes here, before invoking Core::run()
  - config.php        Optional file for defining constants, configuration settings etc
  - routes.php        Optional file for defining routes if using MVC
- controllers         If you are using MVC, controllers must be placed in this directory
  - MyController.php  Controllers must follow this file name pattern
- boggins                 Contains various static helper classes, plus the MVC files (Core, Controller, View, RoutingException)
  - data              Contains helpers for interacting with data stores (MySQL, FS, Mongo), plus the Entity class, which represents Models.
- views               If you are using MVC, views must be placed in this directory

The full boggins package also includes unit tests, build info and documentation, you may safely ignore or remove these.

If you are just using the static helper classes of Boggins, such as Request, Response and Valid, all you need to do to get started is define a class loader. Here is an example as used in the default bootstrap/bootstrap.php file:


function __autoload ($class_name)
    include dirname(__DIR__) . DIRECTORY_SEPARATOR . str_replace('\\', DIRECTORY_SEPARATOR, $class_name) . '.php';

You can then use \boggins\Response; in classes, or \boggins\Str::escape($string); for example.


To use routing, Controllers and Views does not require much more setup:



 * Define some routes


 * Invoke routes
try {

} catch(\Exception $e) {
    // Catch all, just in case
    header('HTTP 1.1 500 Internal Server Error');

    // Log exception and show some message to user




class StaticController extends \boggins\Controller
     * Index
    public function indexAction()
        echo 'I am the index.';



class ProductsController extends \boggins\Controller
     * View a product
    public function viewAction()
        $productName = $this->getParam('name');

        echo View::factory('product', compact('productName'))->render();



<p>This is the page for <?php echo $productName; ?>!</p>

The regular expressions for routes are defined raw rather than being processed or tweaked. Named captures such as name in the example above are passed into Controllers as parameters.


    'action'  // optional, defaults to "index"


  • Developer: Convenience methods for debugging, error handling, and profiling.
  • Log: Helper class for logging errors and info.
  • Page: Methods to assist in constructing common HTML elements, like meta tags.
  • Request: Assists with HTTP requests.
  • Response: Assists with HTTP responses.
  • Str: Functions for working with Strings.
  • Valid: Functions for determining data validity.

Data Stores and Entities

A set of classes for working with databases and I/O, Stores and Entities are fairly primitive so far, but already provide basic schema enforcement and a simplified API for interacting with MySQL.

For more information check the API docs.


Boggins is licensed under the Simplified BSD License.

Thank you for using Boggins!


A mini-framework for simple websites, such as URL shorteners.




No releases published


No packages published