{"id":21757734,"url":"https://github.com/italystrap/settings","last_synced_at":"2026-02-09T19:35:08.640Z","repository":{"id":56994111,"uuid":"230310738","full_name":"ItalyStrap/settings","owner":"ItalyStrap","description":null,"archived":false,"fork":false,"pushed_at":"2024-12-19T11:06:10.000Z","size":564,"stargazers_count":0,"open_issues_count":3,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-20T03:25:22.301Z","etag":null,"topics":["wordpress","wordpress-php-library"],"latest_commit_sha":null,"homepage":"","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ItalyStrap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-12-26T18:33:53.000Z","updated_at":"2024-12-19T11:03:09.000Z","dependencies_parsed_at":"2022-08-21T13:50:26.781Z","dependency_job_id":null,"html_url":"https://github.com/ItalyStrap/settings","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItalyStrap%2Fsettings","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItalyStrap%2Fsettings/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItalyStrap%2Fsettings/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ItalyStrap%2Fsettings/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ItalyStrap","download_url":"https://codeload.github.com/ItalyStrap/settings/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235649885,"owners_count":19023876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wordpress","wordpress-php-library"],"created_at":"2024-11-26T11:16:53.760Z","updated_at":"2026-02-09T19:35:08.556Z","avatar_url":"https://github.com/ItalyStrap.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ItalyStrap Settings API\n\n[![Build Status](https://travis-ci.org/ItalyStrap/settings.svg?branch=master)](https://travis-ci.org/ItalyStrap/settings)\n[![Latest Stable Version](https://img.shields.io/packagist/v/italystrap/settings.svg)](https://packagist.org/packages/italystrap/settings)\n[![Total Downloads](https://img.shields.io/packagist/dt/italystrap/settings.svg)](https://packagist.org/packages/italystrap/settings)\n[![Latest Unstable Version](https://img.shields.io/packagist/vpre/italystrap/settings.svg)](https://packagist.org/packages/italystrap/settings)\n[![License](https://img.shields.io/packagist/l/italystrap/settings.svg)](https://packagist.org/packages/italystrap/settings)\n![PHP from Packagist](https://img.shields.io/packagist/php-v/italystrap/settings)\n\nWordPress Settings API the OOP way\n\n**Work in progress:** the project is currently in beta until considered viable. Until a 1.0.0 release the code in this repository is not stable. Expect changes breaking backward compatibility between minor versions (0.1.x -\u003e 0.2.x).\n\n## Table Of Contents\n\n* [Installation](#installation)\n* [Basic Usage](#basic-usage)\n* [Advanced Usage](#advanced-usage)\n* [Contributing](#contributing)\n* [License](#license)\n\n## Installation\n\nThe best way to use this package is through Composer:\n\n```CMD\ncomposer require italystrap/settings\n```\nThis package adheres to the [SemVer](http://semver.org/) specification and will be fully backward compatible between minor versions.\n\n## Idea of the structure\n\n* Plugin MUST HAVE one options storage (call get_option one time and get all the options)\n* Plugin COULD HAVE one or more settings pages with its own menu link (Parent and/or Child)\n* Settings page COULD HAVE 0, 1 or many section\n* Sections MUST HAVE at least 1 field\n* Sections ARE separated by tabs\n* Plugin COULD HAVE 0, 1 or more links in the plugins.php page\n\n## Basic Usage\n\nThe simpler way to use it is to instantiate the Builder and add the stuff you need.\n\nYou can find last updated code in the [example.php](example.php) file\n\n```php\n\nuse ItalyStrap\\Settings\\Page;\nuse ItalyStrap\\Settings\\SettingsBuilder;\n\n$text_domain = 'ItalyStrap';\n$option_name = 'italystrap';\n$settings_config = \\ItalyStrap\\Config\\ConfigFactory::make(\n\trequire __DIR__ . '/tests/_data/fixtures/config/settings.php'\n);\n\n// Initialize the builder\n$settings = new SettingsBuilder(\n\t$option_name,\n\tITALYSTRAP_BASENAME,\n\tITALYSTRAP_FILE\n);\n\n// You can add configuration via the \\ItalyStrap\\Config\\ConfigFactory::class\n$settings-\u003eaddPage(\n\t$settings_config-\u003eget( 'page' ),\n\t$settings_config-\u003eget( 'sections' )\n);\n\n// Ora manually\n// The section parameter is optional\n// Not every page need a section with fields\n// For example in a docs page\n// Manu title and slug are mandatory\n$settings-\u003eaddPage(\n\t[\n\t\tPage::PARENT\t\t=\u003e 'italystrap-dashboard',\n\t\tPage::PAGE_TITLE\t=\u003e \\__( 'Dashboard 2', 'italystrap' ),\n\t\tPage::MENU_TITLE\t=\u003e \\__( 'Child1', 'italystrap' ),\n\t\tPage::SLUG\t\t\t=\u003e 'slug-for-child-page',\n\t\tPage::VIEW\t\t\t=\u003e __DIR__ . '/tests/_data/fixtures/view/empty_form.php',\n\t]\n);\n\n// You can also add a sub page either for you parent page or for the WP admin pages\n$settings-\u003eaddPage(\n\t[\n\t\tPage::PARENT\t\t=\u003e 'options-general.php',\n//\t\tPage::PAGE_TITLE\t=\u003e \\__( 'ItalyStrap Dashboard 2', 'italystrap' ),\n\t\tPage::MENU_TITLE\t=\u003e \\__( 'Child-general', 'italystrap' ),\n\t\tPage::SLUG\t\t\t=\u003e 'slug-for-child-general',\n\t\tPage::VIEW\t\t\t=\u003e __DIR__ . '/tests/_data/fixtures/view/empty_form.php',\n\t]\n);\n\n// You can also add a link to the plugins.php page in your plugin link for activation\n// For example if you want to add an external link to your docs.\n$settings-\u003eaddCustomPluginLink(\n\t'key-for-css',\n\t'http://localhost.com',\n\t'Custom',\n\t[ 'target' =\u003e '_blank' ]\n);\n\n// After you added pages[?section] and/or link call the build() method.\n$settings-\u003ebuild();\n\n```\n\n## Advanced Usage\n\n\u003e TODO\n\n## Contributing\n\nAll feedback / bug reports / pull requests are welcome.\n\n## License\n\nCopyright (c) 2019 Enea Overclokk, ItalyStrap\n\nThis code is licensed under the [MIT](LICENSE).\n\n## Credits\n\n\u003e TODO","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitalystrap%2Fsettings","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitalystrap%2Fsettings","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitalystrap%2Fsettings/lists"}