CIGen&twbs3

My Codeigniter Scaffolding with twitter bootstrap 3

The Start

Yesterday I was thinking about creating the phpadmin like crud interface for my database tables. About two years ago I found that nice little scaffolding plugin called spark plug on google code. Via the url it allows you to very easily create a basic skeleton of your codeigniter php application.

Codeigniter 3.4/4.x

In October 2014 (blog post), the B.C. Institute of Technology took the lead of the Codeigniter project. The current development is on version 4 of Codeigniter. (Current Stable is Version 3.1) Codeigniter will be compatible with PHP 7. It will use composer dependency managment and is covered with tests, when it will be relased in a stable version. A drawback is that the php intl (~native php language support, intl makes life so easy with multilanguage) module for php needs to be installed and activated, otherwise Codeigniter won’t run. Codeigniter used to be (like joomla from stucture) running on cheap, very simple and basic hosting. In addition the index.php FrontController has been moved to the public directory. Still, before, Codigniter just would run out of the box. The advantages of intl, tests and composer are so enormous that decisions that were made are understandable and anyting else is a philosophical question.

Other php Frameworks with Skeleton generation

Symfony might be the rolls royce use generators via CLI to scaffold almost everything and start coding straight forward php. No fallback to phpmyadmin database manners. Symfony or Laravel also might got a overhead of functionality, even if they have bundles that can be used optionally. Codeigniter is known as a very small footprint php mvc. its about 1.4MB of size. When being a newbie CI’s more than just heaven. So Ci is really rapid php development with the use of it’s good libraries and it’s ActiveRecord (Still ORM like Propel can be added as a self built and added library).

The Motivation

The reason why I changed the source of sparkplug is because twitter bootstrap is really the quasi standard in frontend creation these days. As I always got the idea of pushing it a little bit. I also made it clean and ready for use the way I need it anyway with:

  • Twitter Bootstrap (buttons, tables, alerts)
  • serverside validation preset
  • html5 Markup
  • clientside validation preset
  • CI pagination for the list view
  • xss cleanup

So theres still a bit of additional repetitive work to perform, but still again some time saved:-)

Usage

If you call the url to your sparkplug controller with the method scaffold and the param {tablename} it will generate the whole crud for just one table. While rewriting the sparkplug controller to a fully working new table controller.

MEANS: You create one tables’ crud, rename the controller, paste in the new sparkplug controller, and run again for the next table. just to prevent conflicts:)…then on production site, make shure to remove the spark plug scaffolding.

One table fits all at the moment.
Manual rename of the ci controllers is still required.
This is no different to the original spark plug…
@TODO create startpage with list of all tables…

You’ll find the source of the codeigniter scaffolding library at:

Sparkplug twbs3 on github

My Codeigniter Scaffolding with twitter bootstrap 3 isn’t a fork. But like usual in codeigniter to push creators, it comes with a fully working installation of codeingiter with minimum configuration.

the non fork of ci sunrise please don’t get angry at me hopefully, just don’t like forking yet.

service!