Base CodeIgniter App
A starting point CodeIgniter App filled with useful goodies.
- Clone or download
- Set the following directories to writable:
That's it! No submodules because they are a pain.
- MY_Controller does a ton of cool stuff:
- autoload views by saving them as
controller_name/method_name.phpor define a custom view as
$this->view = 'my_view'or skip the view with
$this->view = false;
- views are loaded into layouts (templates) stored in
views/layouts. The default layout is
application.php. You can change it inside a controller method with
$layout = 'layout_name'. or skip the layout with
$layout = false;
- autoload models by saving them as
controller_name_model.php. It gets loaded as
- filters are functions run before and after controller output. Set them via
public $before_filters = array('method_1', 'method_2');. They take the same params that your controller method does. The point is that you can run them for all but certain methods, only certain methods, or a mix between. Great for authentication!
- auto migrate to latest version. To enable, uncomment
- autoload views by saving them as
- MY_Model lets you greatly reduce necessary model methods, allow validation in the model, enable observers. Check out the source for details, there's too much to explain here.
- Presenters to clean up views dramatically
- REST_Controller to authenticate, format, and present errors properly
- Pigeon and API_Router for RESTful routing
- Updated MY_Migration. You can set the migration table in
- MY_Form_validation for a prefix and suffix for each form error. Set it in
- All public stuff such as index.php and assets goes in
- Add a Composer package by editing
/composer.json, then run
php composer.phar installon the command line from the root directory.
But wait, there's more!
- Jamie Rumbelow's REST_Controller to output in various formats, throttle, authenticate, return API manifest, add debug info, etc. Extend it, set $this->data, and you're done! You can also set
$this->status_codeto a 3-digit number and
$this->respond();to just send a status back
- caching fragments available via the fragment library, repeating partial views via the partial helper
- Using MY_Log to fix chmod issues
- Includes Sparks with the following sparks:
- Includes Kenji's CIUnit for unit testing of models, controllers, helpers, libraries. Unit test examples are in
tests/folder_name. There is a working controller test in
- Twitter Bootstrap for easy, responsive, beautiful, customizable, cross-browser UI goodness.
- API exception handler and manifest library to return formatted API help (both in
- .htaccess from HTML5 Boilerplate with CodeIgniter stuff to remove index.php
- main config and database config are separated into folders for four typical development environments. I usually add environment setting logic based on the HTTP_HOST in index.php.
- Includes FirePHP
- Added FirePHP library
- Added example for Selenium functional test thanks to Phil Palmieri's examples
- Added examples for model, helper, and library tests
- Updated Twitter Bootstrap to 2.2.0
- Show profiler by default if in development environment and it's not an ajax request
- Added autoload sparks line
- Better gitignore
- Added most things above. No need to repeat the entire README again :) .
- Updated submodules
- Updated Twitter Bootstrap to 2.0.2
- Removed copyright statements from docblocks
- Updated all relevant docblocks to @version 1.1.2
- Support for travis-ci
- Updated db config