{"id":20406655,"url":"https://github.com/xwp/wp-safe-input","last_synced_at":"2026-05-07T20:39:43.719Z","repository":{"id":57085462,"uuid":"170302916","full_name":"xwp/wp-safe-input","owner":"xwp","description":"A PHP library for working with form inputs in WordPress","archived":false,"fork":false,"pushed_at":"2019-02-12T13:47:31.000Z","size":28,"stargazers_count":1,"open_issues_count":0,"forks_count":2,"subscribers_count":52,"default_branch":"master","last_synced_at":"2024-04-14T07:34:32.562Z","etag":null,"topics":["php-library","wordpress"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xwp.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-12T10:58:59.000Z","updated_at":"2024-04-14T07:34:32.563Z","dependencies_parsed_at":"2022-08-25T00:50:29.669Z","dependency_job_id":null,"html_url":"https://github.com/xwp/wp-safe-input","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fwp-safe-input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fwp-safe-input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fwp-safe-input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xwp%2Fwp-safe-input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xwp","download_url":"https://codeload.github.com/xwp/wp-safe-input/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241950850,"owners_count":20047711,"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":["php-library","wordpress"],"created_at":"2024-11-15T05:18:38.346Z","updated_at":"2026-05-07T20:39:38.677Z","avatar_url":"https://github.com/xwp.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Safe Input Library for WordPress\n\n[![Build Status](https://travis-ci.com/xwp/wp-safe-input.svg?branch=master)](https://travis-ci.com/xwp/wp-safe-input)\n[![Coverage Status](https://coveralls.io/repos/github/xwp/wp-safe-input/badge.svg?branch=master)](https://coveralls.io/github/xwp/wp-safe-input?branch=master)\n\nA helper library for validating and sanitizing form input data.\n\n\n## Setup\n\nUse [Composer](https://getcomposer.org) to add [this library](https://packagist.org/packages/xwp/wp-safe-input) to your project:\n\n```bash\ncomposer require xwp/wp-safe-input\n```\n\n\n## Usage\n\nSee the sample plugin in the [`example` directory](example).\n\nThe core logic looks like this:\n\n```php\nuse XWP\\SafeInput\\PostMeta;\nuse XWP\\SafeInput\\Request;\n\nadd_action( 'save_post', function ( $post_id ) {\n\t$request = new Request( INPUT_POST );\n\t$meta = new PostMeta( $post_id );\n\n\tif ( $request-\u003everify_nonce( 'nonce-action', 'nonce-input-name' ) \u0026\u0026 $meta-\u003ecan_save() ) {\n\t\tif ( 'on' === $request-\u003eparam( 'input-field-name' ) ) {\n\t\t\t// Update post meta value.\n\t\t} else {\n\t\t\t// Delete post meta value.\n\t\t}\n\t}\n} );\n```\n\nTODO: Document what happens in the example above.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwp%2Fwp-safe-input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxwp%2Fwp-safe-input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxwp%2Fwp-safe-input/lists"}