wp-settings-framework/bin
Owais ahmed 6507e672e7
Improved Settings Class Handling (#3)
feat(core)!: overhaul settings engine, fix data loss, and improve API

This major release resolves a critical data loss bug and refactors the
entire framework to be more robust, configurable, and developer-friendly.

BREAKING CHANGE: The `Settings` class constructor signature has changed.
It now requires `$optionName` and `$pageSlug` as the first two arguments.
Page titles and menu titles must now be passed via the `$options` array
to allow for better configuration.

Example before:
new Settings('My Page', 'my-menu', 'my-option', 'my-slug');

Example now:
new Settings('my-option', 'my-slug', [
    'pageTitle' => 'My Page',
    'menuTitle' => 'My Menu',
]);

---

### Key Fixes and Improvements:

*   **Critical Data Loss Resolved:** A bug that erased settings from
    inactive tabs during save has been fixed. The `Sanitizer` is now
    state-aware, merging new input with existing options to preserve all data.

*   **Reliable Data Retrieval:** The public `get()` method, which was
    previously non-functional, has been completely repaired. It now
    correctly fetches saved values from the database with proper fallbacks
    to field defaults.

*   **Enhanced Configuration & API:**
    - New fluent methods `setCapability()` and `setParentSlug()` have been added.
    - All text strings are now configurable via a `labels` array in the
      constructor, improving support for internationalization (i18n).
    - External asset libraries (like Select2) can now be configured.

*   **Internal Architecture:** These improvements were made possible by a
    complete internal refactor, which introduced a new `Config` class
    for state management and enforced proper dependency injection.
2025-08-13 01:18:34 +05:00
..
composer chore: initialize the project 2025-08-11 23:59:59 +05:00
copy chore: initialize the project 2025-08-11 23:59:59 +05:00
docker chore: initialize the project 2025-08-11 23:59:59 +05:00
README.md Improved Settings Class Handling (#3) 2025-08-13 01:18:34 +05:00

Command-Line Scripts

This directory contains all the wrapper scripts used to manage and interact with the project's development environment. These scripts are designed to be run from the project root.


bin/docker

This is the primary script for interacting with the Docker environment. It's a smart wrapper around docker compose that simplifies container management and command execution.

Shorthand Container Access

The script's default behavior is to execute commands directly inside the main app container. Any command that is not a special management command (listed below) is passed through.

Command Description
./bin/docker Open an interactive bash shell inside the default app container.
./bin/docker <cmd...> Run any command with its arguments inside the app container.
Example: ./bin/docker php -v Checks the PHP version inside the container.
Example: ./bin/docker ls -la Lists files in the container's default working directory (/app).

Environment Management Commands

These special commands are used to control the Docker Compose stack.

Command Description
up Start all services defined in docker-compose.yml in detached mode.
down Stop and remove all containers, networks, and volumes.
build [service...] Rebuild and restart services (default: all).
restart [service...] Restart one or more services (default: all).
logs [service...] Follow log output from one or more services (default: all).
exec <service> <cmd...> Execute a command in a specific service container.
Example: exec db mysql Opens a MySQL command-line client inside the db container.

bin/composer

This is a dedicated wrapper script for Composer. It simplifies running Composer commands by automatically forwarding them to be executed inside the app container.

Instead of typing ./bin/docker composer <command>, you can simply use:

Command Description
./bin/composer install Install all PHP dependencies from composer.lock.
./bin/composer update Update PHP dependencies to their latest versions.
./bin/composer require vendor/package Add a new PHP package to the project.
./bin/composer remove vendor/package Remove a PHP package from the project.

Setup Scripts

These scripts are typically used only during the initial setup of the project.

bin/copy

This script prepares your local environment by copying all necessary configuration files from their templates.

Command Description
./bin/copy Copies template files (e.g., .dist, .example) if the destination does not already exist.
./bin/copy --override Forces the copy, overwriting any existing configuration files.