CodeIgniter Forums
Preferences Library - Printable Version

+- CodeIgniter Forums (
+-- Forum: CodeIgniter 4 (
+--- Forum: CodeIgniter 4 Addins (
+--- Thread: Preferences Library (/thread-80597.html)

Preferences Library - MGatner - 11-19-2021

Hi all- With the advent of the official "CodeIgniter Settings" library ( I've decided to deprecate my popular Settings library ( due to the significant overlap in name, features, and functionality. The biggest feature gap this leaves, however, is providing user-specific settings handling (e.g. allowing authenticated users to change their profile picture or set a theme). To fill this gap, I give you:
Persistent user-specific settings for CodeIgniter 4
"Preferences" builds on "CodeIgniter Settings" and your authentication-library-of-choice to provide contextual settings for the authenticated user. Similar to Settings, there is a convenient helper function to turn this into a very easy set/get call. Here's a simplistic example of using dynamic themes for your users:
PHP Code:
class Home extends Controller
    public function index()
        return view('welcome', [
            'theme' => preference('theme'),

    public function update_theme()
        if ($theme $this->request->getPost('theme')) {

        return redirect()->back();

As always, drop a comment here or stop by the repo with feature requests or feedback of any kind! Thanks for reading.