Search by

cuongcds / ci3-cms

cuongcds

Reusable Blog CMS package for CodeIgniter 3.1.13 projects

Package info

github.com/cuongcds/ci3-cms

pkg:composer/cuongcds/ci3-cms

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

0.1.3 2026-09-16 16:11 UTC

This package is auto-updated.

Last update: 2026-09-16 16:30:28 UTC


README

Reusable Blog CMS Composer package for CodeIgniter 3.1.13 projects — Posts, Categories, Tags, Media, SEO, Admin, REST API.

Installation

composer require cuongcds/ci3-cms

Add the bootstrap require to application/config/config.php, right after the $config['composer_autoload'] block:

require_once APPPATH . '../vendor/cuongcds/ci3-cms/bootstrap.php';

Register a CmsUserProviderInterface implementation, typically in application/core/MY_Controller.php:

class MY_Controller extends CI_Controller
{
    public function __construct()
    {
        parent::__construct();

        $this->load->library('cms_lib');
        $this->cms_lib->setUserProvider(new My_cms_user_provider());
    }
}

Then install:

php index.php cms install

This creates application/config/cms.php, runs migrations, creates the upload directory, generates application/config/cms_routes.php with a single require_once __DIR__ . '/cms_routes.php'; line added to application/config/routes.php, and publishes the controller stubs cms install needs (see "Architecture" below).

  • Admin: /admin/cms/posts, /admin/cms/categories, /admin/cms/tags, /admin/cms/media
  • Frontend: /blog, /blog/{slug}, /blog/category/{slug}, /blog/tag/{slug}
  • API: /api/cms/posts

Deploying to a new server

composer install --no-dev
php index.php cms migrate
php index.php cms publish

Configuration

Override any key in application/config/cms.php (created by cms install) — table names, admin_prefix/frontend_prefix/api_prefix, media driver, pagination, API token, etc.

Architecture

  • src/ — framework-free Core (Gendo\Cms\ namespace, Composer PSR-4): Contracts, Domain entities, Services, Support.
  • adapters/codeigniter3/ — CI3 adapter: controllers, CI_Model subclasses, the Cms_lib library (DI bridge, exposed as $this->cms_lib), views, migrations, default config.

CI3's dispatcher only ever looks for the requested controller under application/controllers/ — it never searches package paths for the initial controller. php index.php cms install (and cms publish) therefore generates small stub files under application/controllers/ that require the real package controllers; do not edit these stubs, they're regenerated on every install/publish.

Routes work the same way: all CMS routes live in a generated application/config/cms_routes.php (regenerated on every install), and application/config/routes.php itself is only ever touched once, to add a single require_once __DIR__ . '/cms_routes.php'; line — no marker-based text surgery on a file you may also be editing by hand.

Hooks

add_action('cms_post_created', function ($post) {
    // ...
});

Available events: cms_post_before_create, cms_post_created, cms_post_before_update, cms_post_updated, cms_post_deleted.

Out of scope (this version)

S3/Minio/R2 media drivers (interface + local driver only), full-text search, dynamic custom-fields UI, bundled rich-text editor JS (config/attribute hook only), production-grade multi-user API auth (single static bearer token + optional callback override).