承接 codesoup/options 相关项目开发

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

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

codesoup/options

Composer 安装命令:

composer require codesoup/options

包简介

Framework-agnostic WordPress options manager using custom post types. Supports ACF, custom metaboxes, and extensible integrations.

README 文档

README

Version 1.1.0 - WordPress options manager using custom post types with built-in ACF integration.

Manage WordPress options using custom post types instead of the wp_options table. Includes built-in Advanced Custom Fields integration and can be extended to use with any field framework (CMB2, MetaBox.io, Carbon Fields) or native metaboxes.

CodeSoup Options Preview

Features

  • Tabbed UI - Organize options in tabs with horizontal or vertical layouts
  • Automatic Capabilities - Post type and custom page capabilities automatically added to administrator role
  • Revision History - Track changes over time
  • Post Locking - Prevent concurrent edits
  • Better Organization - Multiple option pages with capability control
  • Built-in ACF Integration - Works out of the box with Advanced Custom Fields
  • CodeSoup Metabox Schema - Designed to work with CodeSoup Metabox Schema for declarative form generation
  • Extensible - Can be extended to use with CMB2, MetaBox.io, Carbon Fields, or native metaboxes
  • Two UI Modes - Choose between traditional pages mode or tabbed interface

Requirements

  • PHP >= 7.4
  • WordPress >= 6.0
  • Optional: ACF, CMB2, MetaBox.io, or Carbon Fields

Installation

Via Composer

composer require codesoup/options

As WordPress Plugin

  1. Download and extract to wp-content/plugins/codesoup-options
  2. Activate the plugin
  3. Add configuration to your theme or plugin

Quick Start

Native Metaboxes (No Framework)

use CodeSoup\Options\Manager;

$manager = Manager::create(
	'site_settings',
	array(
		'menu_label'   => 'Site Settings',
		'integrations' => array(
			'acf' => array( 'enabled' => false ),
		),
	)
);

$manager->register_page(
	array(
		'id'         => 'general',
		'title'      => 'General Settings',
		'capability' => 'manage_options',
	)
);

$manager->register_metabox(
	array(
		'page'  => 'general',
		'title' => 'Site Information',
		'path'  => __DIR__ . '/templates/site-info.php',
		'class' => 'site-info-metabox',
	)
);

$manager->init();

// Retrieve options
$options = Manager::get( 'site_settings' )->get_options( 'general' );

Note: You must create your own HTML fields in the template and implement a save handler using Manager::save_options(). See Native Metaboxes for details.

With ACF (Default)

use CodeSoup\Options\Manager;

$manager = Manager::create( 'theme_settings' );

$manager->register_page(
	array(
		'id'          => 'general',
		'title'       => 'General',
		'capability'  => 'manage_options',
		'description' => 'General site settings and configuration',
	)
);

$manager->init();

// Retrieve options
$logo = Manager::get( 'theme_settings' )->get_option( 'general', 'site_logo' );

Note: Create ACF field groups and assign them using the "CodeSoup Options" location rule (select your page ID, e.g., "general"). ACF handles saving automatically - no save_post hook needed. See ACF Integration for details.

Documentation

Agent Skills

AI-optimized documentation for agents is available in the skills/ directory. See skills/README.md for installation and usage.

Configuration

Manager::create(
	'instance_key',
	array(
		// Core settings
		'post_type'      => 'custom_options',
		'prefix'         => 'custom_',
		'revisions'      => true,
		'debug'          => false,

		// Menu configuration
		'menu'           => array(
			'label'    => 'Settings',
			'icon'     => 'dashicons-admin-settings',
			'position' => 50,
			'parent'   => null,
		),

		// UI configuration
		'ui'             => array(
			'mode'          => 'pages',  // 'pages' or 'tabs' (see docs/tabbed-ui.md)
			'tab_position'  => 'top',    // 'top' or 'left' (tabs mode only)
			'templates_dir' => null,     // Custom templates directory path
		),

		// Assets configuration
		'assets'         => array(
			'disable_styles'  => false,  // Disable plugin styles
			'disable_scripts' => false,  // Disable plugin scripts
			'disable_branding' => false, // Disable CodeSoup branding header
		),

		// Integrations
		'integrations'   => array(
			'acf' => array(
				'enabled' => true,
				'class'   => 'CodeSoup\\Options\\Integrations\\ACF\\Init',
			),
		),
	)
);

Note: The old flat configuration structure triggers deprecation warnings. See Migration Guide to upgrade.

License

GPL-3.0+

Support

codesoup/options 适用场景与选型建议

codesoup/options 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 382 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 09 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「wordpress」 「options」 「extensible」 「Settings」 「metabox」 「acf」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 codesoup/options 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 codesoup/options 我们能提供哪些服务?
定制开发 / 二次开发

基于 codesoup/options 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: GPL-3.0-or-later
  • 更新时间: 2026-02-09