承接 adnduweb/ci4_settings 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

adnduweb/ci4_settings

Composer 安装命令:

composer require adnduweb/ci4_settings

包简介

Lightweight settings management for CodeIgniter 4

README 文档

README

Lightweight settings management for CodeIgniter 4

Quick Start

  1. Install with Composer: > composer require adnduweb/settings
  2. Update the database: > php spark migrate -all
  3. Add settings: > php spark settings:add timezone user America/New_York
  4. Load the service: $settings = service('settings');
  5. Get/set settings per user:
$settings->timezone = $_POST['timezone_preference'];
...
$userTimezone = $settings->timezone;

Features

Provides ready-to-use settings management for CodeIgniter 4

Installation

Install easily via Composer to take advantage of CodeIgniter 4's autoloading capabilities and always be up-to-date:

  • > composer require adnduweb/settings

Or, install manually by downloading the source files and adding the directory to app/Config/Autoload.php.

Once the files are downloaded and included in the autoload, run any library migrations to ensure the database is setup correctly:

  • > php spark migrate -all

Configuration (optional)

The library's default behavior can be altered by extending its config file. Copy Settings.php to app/Config/ and follow the instructions in the comments. If no config file is found in app/Config the library will use its own.

Usage

Once the library is included all the resources are ready to go and you are ready to start adding settings. You may import setting templates directly into the settings table or add them manually with the CLI command php spark settings:add.

Settings also comes with a database seeder for some recommended default templates. Run the seeder from the command line:

php spark db:seed \\Adnduweb\\Settings\\Database\\Seeds\\SettingsSeeder

This will add appropriately-scoped templates and default values for the following settings:

databaseTimezone, serverTimezone, timezone, siteVersion, theme, perPage, brandName, brandLogo, orgName, orgLogo, orgUrl, orgAddress, orgPhone

Note that the seeder will not overwrite existing values so it is safe to run at any time. See src/Database/Seeds/SettingsSeeder.php for the complete list with scopes, descriptions, and default values.

Scope

Settings take one of three scopes: session, user, global.

  • Global settings are the same for every user and provide a dynamic way to set application-wide values
  • User settings start with a default template value but each user may make their own default that persists across sessions
  • Session settings start with a default template value and may be changed by a user but revert for each new session

Examples:

+---------------+---------+------------------+----------------------------------------------+------------+
| Name          | Scope   | Content          | Notes                                        | Protected? |
+---------------+---------+------------------+----------------------------------------------+------------+
| latestRelease | global  | 0.7.6            | Git-style tag of latest code release         | 0          |
| perPage       | user    | 10               | Default number of items to show per page     | 1          |
| timezone      | user    | America/New_York | Local timezone to use across the application | 1          |
| jobsSearch    | session |                  | User's most recent search term for jobs      | 1          |
+---------------+---------+------------------+----------------------------------------------+------------+
  • When you release a new version of your software:

$settings->latestRelease = $newVersion;

  • When a user searches a list of jobs:
$settings->jobsSearch = $_POST['searchTerm'];
$data['jobs'] = $jobModel->paginate($settings->perPage);

统计信息

  • 总下载量: 38
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固