Skeleton is a PHP boiler plate. You unzip and go!
PHP JavaScript CSS HTML Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Skeleton is a framework, flow, and CMS for making a PHP web projects very quickly and efficiently.

Whaaa da fuh?

The primary intended audience of this document and Skeleton for that matter is the web developer. So if something is flying over your head here, I apologize, however it probably would be best to have a web developer help you. If some day there is a "thing" that makes websites/projects without the need of a web developer, well I guess I/we won't be needed anymore.

Why use Skeleton?

Separation of Work

The primary purposes of Skeleton is to separate the work of making a web project.

The Web programmer, Designer and Content Manager all need to be able to work on their part of a web project without interferring with each others work.


Skeleton is not a huge Object Orientated Layer Cake. The learning curve to Skeleton ^should^ be / is small. By not being a massive solve all solution like Drupal or Joomla or ... , Skeleton can get you up and going very quickly.

Skeleton doesn't need a caching server like varnish although it could use one if desired. Skeleton, unless you tell it to, will not run 3000+ sql statements and consume 640mb of ram on one page request.


At no point was Skeleton made to make specific projects like: "Corporate Portals" or "Youth Campaigns" or "Facebook Apps". That having been said, you can mold Skeleton to what you need. Skeleton just tries to give you basic tools so that you can get started quickly.

If you are making a small static site, no problem Skeleton can be used for the templating engine and have hard coded HTML in the pages. If you want to make a large social media platform. No problem, make modules for users, likes, posts, customized exactly how you want and go for it!

Don't like the "Twig" templating engine? no problem, take it out and use "Smarty".

Click and Weight is so 2000 n Late

My biggest gripe that I have about modern CMSs or Frameworks is that everything is in a gui interface. All the settings for Drupal, Wordpress, and others all store variables, settings, and configurations in the DB and often it's a long jungle trek to get to those settings to change them or add new things. Especially when you are on a mobile device.

This leads to "Click and Weight" development and it's frustrating to say the least.

This "click and wait" style development leads to logistical problems especially when you go from local to staging to production environments. Special export/import routines need to take place to move new settings in the DB from one to another to another.

Skeleton handles that problem with migrations and structural exporting.

Nothing in Skeleton is hidden in layers of GUI. Just open up a file, edit, save, reload.

Normally, I put projects in Beanstalk. With deployments from Beanstalk I am able to make changes to a file online using my phone, laptop, "device" and commit. Beanstalk automatically uploads to the staging or production. All the while I can keep enjoying the sun and good weather in southern France.


I highly recommend Beanstalk:


Skeleton is completely free. If you make a zillion dollars by copying Skeleton and making it your own good for you. I only ask that you atleast buy me a pizza and/or beer and/or high quality mountainbike.


If you use Skeleton you are using an "as is" product. I don't have the time to be a helpdesk. However, I will try to answer questions that are asked nicely. You need to send a nice and polite email to me. My email: brownrl at "google's email thing" dawt com.

Downloading Skeleton

Skeleton is worked on and maintained by me. Maybe someone will join the team later. All the code for Skeleton is located/stored at github.

You can down load a zip:

Installing Skeleton

  1. Download the zip.
  2. Unzip to a php web space.
  3. Run composer, ./composer.phar update
  4. Run the permissions script ./permissions
  5. Browse to the web space.

If you don't have shell access, make these read, write, and executable to all, recursively

chmod -R 777 db uploads


Getting Started

To Make a New Page

  1. Create a file "mypage.html" inside of the "html/pages/" directory
  2. Put your HTML content for that page in there.
    • Not the whole page but just the content
  3. Browse to or

Doing the PHP

  1. Create a "mypage.php" in the "php/" directory.
  2. Place your php in there for this page.
  3. Add something to the "$assigns[]" array.
  4. Use it in your "mypage.html" as a twig variable.
    • In mypage.php: $assigns['hello'] = "Hello World";
    • Then in mypage.html: {{ hello }}

Globals / PHP

You can have php or variables on every page by adding that code to "inc/universal_assigns.php". Whatever is done in this file is present in all pages. For example:

        $assigns['year'] = date( "Y" );

You then would be able to do {{ year }} in every page and have the current year.


All websites (at least the good ones) should be using templating.

Templates allow for the same piece of HTML to be used repeatedly without having to rewrite the code in every file. Plus when you do make a change to the template, you make a change for all pages that use it. Imagine that your company changes it logo. Without templating, you would need to change the logo in every page.

Templates also allow the designer to make a layout and specify "This Box" as the place when a piece of content can be or "That Box" for the "total number of articles". The content manager or the web developer will then be responsible for "filling in the blanks".

Templates for your project are placed in the directory:


The default template for the whole site needs to be named:


This template will be used for every page that doesn't have it's own overriding template.

If you need to use a special template for a special page, then you can create a separate template. For example: "mypage.html" could have a special template and it should be named: "mypage.html" in the "html/templates/" directory.


Blob are pieces of template that you can use and insert where you need. Typically a blob could be used for a navigation menu. Blobs are palce in:


To use a blob in a page or a template you use an include:

{% include 'blobs/header.html' %}
<!-- some html -->
{% include 'blobs/footer.html' %}


In both the templates and the pages you can use Twig templating syntax.

Twig has a number of plugins, features, add-ons, that will allow you make the business of making HTML easier, clener, corrector?

The most important twig tag that you will use will be in the template:

{{ content }}

This will produce the individual pages content at that spot in the template.

Going Deeper

The Workflow

At its heart, Skeleton is a procedural workflow. The idea is simple. Put PHP in one place and do some programming. Then in another place present HTML to the world. To accomplish this Skeleton, just like all other frameworks funnels or "bootstraps" requests through the main index.php file.

index.php becomes a sort of mini app/controller. In the case of Skeleton this is what is does.

  request -> index.php?page=example

             |  -> db connect, languages, helpers, twig
             |  -> "inc/universal_assigns.php"
  index.php  |  -> page pre processing PHP "php/example.php"
             |  -> compile the page content "html/pages/example.html"
             |  -> compile template "html/templates/index.html"
             |  -> display the result

Why does this help?

PHP is done in a php file by a php programmer.

HTML/CSS/Templating is done in the pages or templates by an integrator.

Content management is done by a content manager in the admin.

It's a common goal of most frameworks and CMS to separate these tasks as much as possible. By using Skeleton the overlap and conflicts of these jobs are minimized.

The Database

The database is a sqlite database. PHP/PDO/Skeleton are using sQlite v3.


It works, handles decent traffic and is simple to use and portable.

However, if you want to use mysql or something else I unerstand.

Guess What?

The database is wrapped in PDO abstraction and you can change to mysql by modifying the "inc/db.php" file.

By using PDO though, Skeleton should be able to work with any DB that has a PDO driver in PHP. I have a number of sites using mysql too.

Using the Database

The file:


This file wraps the sqlite database in PDO abstraction. Additionally, inside of db.php there are a number of wrapper/helper functions to give you assistence and speed later on.

For eaxample, all queries go through a function:

  • dbQuery( $q )

This ensures that if the way you want to do queries changes, you just need to change the one function and shouldn't have to rewrite all of your code. No need to thank me, just pay it forward...

Read through and look at the "inc/db.php" the functions there should be more than enough to help you make just about any web proejct. If you got an idea for more or changes, please don't hesitate to add them and/or contact me and suggest them.

The most important helper functions in db.php probably are:

  • dbInsertFromVals()
  • dbUpdateFromVals()

These will generate the sql statement needed to insert or update a record in the database.

Spot2 & ORM

Skeleton relies on Spot2 ORM. What is ORM? Object-relational mapping.

ORM takes the SQL out of the developers hands. This is a good thing. I, like most other developers out there never actually learned how to type correctly. By using ORM the developer is not writing the the SQL for interacting with the datbase. Instead object orientated style code is used to generate 100% correct and fault tolerant SQL.

If you wish to use ORM as well in your project, then take a look at the existing classes and files in the directory.


This will give you a good run down of what is happening in Skeleton and also how to use Spot2. Sincing using ORM in my projects I have saved time and increased quality. It is surely recommended.

Any new Spot2 ORM class you put into this directory will be usable in the project. So go nuts and make your ORM Models.

Admining the Database

In the admin you can find a link to phpliteadmin. This is essentially just phpmyadmin but for a sqlite database. Import, export, all very handy.


In addition to this tool you can admin your database using a number of other 3rd party tools for sqlite.


Skeleton out of the box handles languages. Whether the site/project you are going to make uses 1 or 190 languages you should be able to use Skeleton to get it done. To manage the languages of your project, go to the Admin -> Site Structure -> Languages.


Here you can add or take away languages to a site. You can say which domain names a language uses as well. So if a visitor comes to your Dutch domain name, the default language will be Dutch.

In your pages or templates you can abstract text by using the {{ gT( "xxxx" ) }} plugin.

  {{ gT( "a_piece_of_text" ) }}

This will generate a text place holder, with a runestone of "a_piece_of_text". The actual text can then be edited or modified in the admin. This text holder will display the text for the appropriate current language.

To change the current language you need to change the url to have a "language=XX" $_GET variable. There are some premade variables that you can use later in your coding.

Here is a very typical sample of twig code that will produce a language menu.

<h4>{gT l="choose_language}</h4>
    <a href="{{ languagelinkbase }}&language=nl">{{ gT( "dutch" ) }}</a> |
    <a href="{{ languagelinkbase }}&language=fr">{{ gT( "french" ) }}</a>

This example would even get you the "^cool^ language switch without going to the home page" effect. ;)

The current language is stored in twig {{ l }} so if you want to show a special picture based on language your img tag would look something like this.

<img src="assets/img/somepic-{{ l }}.jpg" />

This then would show somepic-en.jpg or somepic-nl.jpg based on the current language.

In PHP you can see the current lanuage by using LANGUAGE super global. You can also use the gT() function to get some translated text.

The Admin

Logging in

To log into the admin you need to go to your webspace with "/admin" added at the end.

The default login and password is "admin" and "notadmin".

To change this and other login settings edit the file logins.conf.php

There are comments there to help you further.

What is the admin?

The admin is a micro app separate from the front end web site. If your site is static and just using the front end twig, then go ahead and delete the admin directory.

The main purpose of the is to do C.R.U.D. (Create, Report, Update, Delete).

Manage the content in database tables and allow the client/you/admins/etc... to control the site/project.

If you got a web project that deals with recipes, you probably have a recipes table in your database. The admin essentially, should be a place where you/the client/web admins/etc... can manage recipes.

Ofcourse the admin can have other functionalities such as managing file uploads or setting some variables. That will be covered at another time. For now we just focus on CRUD.

Admin Modules

The admin is based on modules/db tables. The modules are located in the directory:


Each module is a sub-directory containing php files that correspond to module "actions". In our example of recipes for the creating of a new recipe we would have the following:

    -> recipes/
        -> pre-create.php
        -> create.php

To call this module and action in the admin we would form the following url:

"create" is the action, thus the URL would be:


What happens at this point is the "admin/index.php" processes "pre-create.php", then displays the admin layout and includes the "create.php".

So create.php will contain a form and some html usually.

While the pre-create.php will contain the PHP for inserting the data from the form into the database.

index is the defaut action

'index' is the default action for a module. Thus,

    -> index.php
    -> pre-index.php

index.php contains the html and basics for displaying the master list of recipes in a table.

While pre-index.php is doing the query on the database, sorting, ordering, pagination and other essential pre-processing activities.

Creating DB Tables

Since using ORM, I am now leaving the creation of database tables to the hands of the orm classes. I you want your project to have a db table, you will need to define that in the orm-classes or create one yourself using the phpliteadmin. Again I SUPER HIGHLY DUPER recommend that you take a look at Spot2.

In the Tools section of the admin, there is a "Migrate DB" item. Clicking this will scan all the classes in the orm-classes directory


and perform a migrate function on the class. This inturn will create your DB tables and change your columns and whatever you put into your migrations. This is super handy for moving DB changes from local dev, to staging, production.

Create a Mock Module

Skeleton has a tool to create mock modules to get you fully started with some basic crud.

This tool is located at this URL:


By giving in the name of the module, (recipes) and the singular of the module, (recipe), you will generate a premade .zip file that can be unzipped and uploaded to the "admin/modules/" directory. The mock module will contain a great amount of commenting to help your further. The basics of create, update, delete, and index will be there already.

Creating an Admin Form

You can create a basic form based on what fields/tables are in your database. The admin has a tool to do this in the admin -> tools section. To further refine and enhance your form you can use the pre-made copy and pastables in the tools for various field types, textareas, files, dates.

Typically, creating and updating use the same form. So I will usually put this form in a separate form.php file and include it from create.php or update.php. Then depending on what the fields are I will copy and paste and change the form fields appropriately.

Skinning the Admin

So you have a client that wants the admin to look a certain way?

In the "skins" directory you can create a new theme for the admin.

Simply copy, the "default" directory and name it what you want. Then go into the new directory. You can change a number of items, header.php, footer.php, custom.css., favicon.ico.