Download the PHP package olajideolamide/ci4-settings without Composer

On this page you can find all versions of the php package olajideolamide/ci4-settings. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package ci4-settings

CodeIgniter 4 Settings & Feature Flags Library

Latest Version on Packagist GitHub License

Database-backed application settings and feature flags for CodeIgniter 4, with dot-notation support, automatic type casting, and optional caching.

This package gives you a simple settings() helper and a small Settings library so you can store configuration in the database instead of hard-coding everything in config files.


Features


Requirements


Installation

1. Install via Composer

2. Register the namespace (if needed)

In most Composer-based CodeIgniter 4 apps, Composer’s autoloader is already wired up.
If you are using modules and explicit namespaces, add the package namespace to app/Config/Autoload.php:

3. Run the migration

This package ships with a migration that creates the settings table.

Run:

This will create a table named settings with columns:

4. Load the helper

To use the settings() and feature() helpers, load the helper:

Per controller / per use:

Globally (recommended):

In app/Config/Autoload.php:

Or in a base controller:


Quick Start

Once installed, migrated, and the helper is loaded, you can start using it immediately.

Get a setting

Set a setting

Check if a setting exists

Delete a setting

Access all settings


Feature Flags

Feature flags make it easy to toggle functionality on or off without redeploying code.

Enable a feature flag

Feature flags are stored as keys under the feature. namespace, for example: feature.new_checkout.

Check if a feature is enabled (helper)

You can also pass the full key:

Check with a default value

Under the hood, feature('something'):


Dot-Notation & Nested Settings

This library supports dot-notation for keys, and can store arrays/objects as JSON.

Storing a nested array

Internally this is saved as:

Reading nested values

Updating part of a JSON setting

You can overwrite the whole array:

Or add nested configuration piece by piece using a more granular key:

When JSON values are loaded, they are decoded into arrays and merged into the full settings structure so that dot-paths like app.mail.host work as expected.


Type Handling

The library automatically detects and casts types based on the value you set.

Detection

When you call set($key, $value, ...), the library determines:

Casting on read

When you call get() or settings('key'):


Settings Helper & Library API

settings(?string $key = null, mixed $default = null)

Examples:

feature(string $flag, bool $default = false): bool

Convenience wrapper around Settings::featureEnabled().


Jide\Settings\Libraries\Settings methods

If you prefer to work with the library directly:

Available methods:


Caching

This library uses a small config class to control caching:

By default:

If you want to customise these values at runtime, you can instantiate the library with your own config:

Note: the helper('settings') uses new Settings() with the default config.
If you need a customised config, create your own Settings instance as above.


Building an Admin UI (Optional)

The table contains extra metadata to help you build an admin/settings UI:

Example: only list feature flags:


License

This project is open-source software licensed under the MIT license.


Author

Olanrewaju “Jide” Olajide


All versions of ci4-settings with dependencies

PHP Build Version
Package Version
Requires php Version ^8.0
codeigniter4/framework Version ^4.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package olajideolamide/ci4-settings contains the following files

Loading the files please wait ...