Reusable Blog CMS Composer package for CodeIgniter 3.1.13 projects — Posts, Categories, Tags, Media, SEO, Admin, REST API.
composer require cuongcds/ci3-cmsAdd 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 installThis 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
composer install --no-dev
php index.php cms migrate
php index.php cms publishOverride 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.
src/— framework-free Core (Gendo\Cms\namespace, Composer PSR-4): Contracts, Domain entities, Services, Support.adapters/codeigniter3/— CI3 adapter: controllers,CI_Modelsubclasses, theCms_liblibrary (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.
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.
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).