netsiteweaver / codeigniter3-versioning
Release versioning (history, public release links, email notifications) for CodeIgniter 3
Package info
github.com/netsiteweaver/ci3-versioning
pkg:composer/netsiteweaver/codeigniter3-versioning
Requires
- php: >=7.0
This package is auto-updated.
Last update: 2026-05-13 13:44:20 UTC
README
Composer package (library type) shipping installable stubs for a CodeIgniter 3 release-versioning module: history table, admin UI, public release links with token, and optional email notifications.
Package name: netsiteweaver/codeigniter3-versioning
This folder is intended to live in its own Git repository (publish to GitHub, then composer require netsiteweaver/codeigniter3-versioning once you register it on Packagist or use a VCS repository URL).
Requirements
- PHP 7.0+
- CodeIgniter 3
- Existing app pieces this module expects:
MY_Controllerwith$this->data(includingcompanyfor layouts and release page)system_modelwithgetParam,setParam,getCompanyInfoaccesscontrol_modelwithauthorised('version', …)andisAuthorised()helperemail_model2withsave($recipients, $subject, $content, …)(only if you use email notifications)- Helpers:
getPagination, flash helpers (flashSuccess,flashDanger, etc.) - Admin layout path used in
Version.php:/layouts/AdminLTE-3.2.0/default— change in the copied controller if your layout differs - Summernote (or adjust
version_form.js) for the release notes editor on the form page
Install
1. Composer
From your CI3 project root:
composer require netsiteweaver/codeigniter3-versioning
Or add a VCS repository in composer.json until the package is on Packagist.
Files to copy live under:
vendor/netsiteweaver/codeigniter3-versioning/resources/install/
2. Copy application files
Copy into your application/ tree:
| From package | To your app |
|---|---|
resources/install/application/controllers/Version.php |
application/controllers/Version.php |
resources/install/application/models/Version_model.php |
application/models/Version_model.php |
resources/install/application/views/version/ |
application/views/version/ |
resources/install/application/views/email/version/ |
application/views/email/version/ |
3. Assets
Copy JS (and ensure Summernote + version_form.js are loaded on the release form page; version_notifications.js on the notifications page):
resources/install/assets/js/pages/version_form.js→ your public assets folder (e.g.assets/js/pages/)resources/install/assets/js/pages/version_notifications.js→ same
The notifications script expects global base_url and setFooterMessage like the reference app — adapt if your JS conventions differ.
4. Migrations
Copy the two migration files from resources/migrations/ into application/migrations/ and rename only the numeric prefix so they run after your latest migration (e.g. 094_Versioning_schema.php, 095_Versioning_menu.php).
Keep the PHP class names unchanged: Migration_Versioning_schema and Migration_Versioning_menu (CodeIgniter maps them from the part of the filename after the number).
Run migrations as you normally do (CLI or Migrate controller).
- 001 / schema: creates
version_history(includingtoken), seedsparamscurrent_versionandversion_notify_emails. - 002 / menu: inserts Versioning menu tree and
permissionsfor all active users. Skips if aversion/indexmenu row already exists.
If your menu table columns differ from a typical lemon-yellow schema, adjust migration 002 before running.
5. Auth: public release URL
Allow guests to open version/release/{id}/{token} (email links). In your auth hook (example pattern):
( ($controller == 'version') && ($method == 'release') )
Add that next to your other unauthenticated routes.
6. Optional: global current version in layout
In MY_Controller (or equivalent), load the model once and expose the string:
$this->load->model('version_model'); $this->data['current_version'] = $this->version_model->getCurrentVersion();
7. System_model helper
Add this method to your System_model (or equivalent) so the notifications screen can save recipients:
public function updateVersionNotifyEmails() { $value = $this->input->post('version_notify_emails'); $this->db->set('value', $value === null ? '' : $value)->where('title', 'version_notify_emails')->update('params'); }
Publishing this repo
cd netsiteweaver/codeigniter3-versioning git init git add . git commit -m "Initial release: CodeIgniter 3 versioning module"
Create an empty repository on GitHub, add origin, and push. Then submit to Packagist or reference the Git URL in consuming projects.
License
MIT