{"id":23387239,"url":"https://github.com/wp-forge/wp-update-handler","last_synced_at":"2025-04-11T05:09:14.825Z","repository":{"id":57082033,"uuid":"411804422","full_name":"wp-forge/wp-update-handler","owner":"wp-forge","description":"A WordPress package for updating custom plugins and themes based on an API response from a custom update server.","archived":false,"fork":false,"pushed_at":"2024-02-16T18:08:16.000Z","size":21,"stargazers_count":12,"open_issues_count":1,"forks_count":4,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T05:09:06.829Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"","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/wp-forge.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-09-29T19:29:19.000Z","updated_at":"2024-11-13T11:55:42.000Z","dependencies_parsed_at":"2024-06-21T07:10:33.658Z","dependency_job_id":"16aa140d-ea73-4458-a73d-3b881d8e1221","html_url":"https://github.com/wp-forge/wp-update-handler","commit_stats":{"total_commits":7,"total_committers":2,"mean_commits":3.5,"dds":0.4285714285714286,"last_synced_commit":"4dbc5e0dd4dfbb5808f9d53b1b3afd65c3db7435"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-update-handler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-update-handler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-update-handler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wp-forge%2Fwp-update-handler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wp-forge","download_url":"https://codeload.github.com/wp-forge/wp-update-handler/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345266,"owners_count":21088244,"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":["hacktoberfest"],"created_at":"2024-12-22T01:15:22.104Z","updated_at":"2025-04-11T05:09:14.802Z","avatar_url":"https://github.com/wp-forge.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WordPress Update Handler\n\nA WordPress package for updating custom plugins and themes based on an JSON REST API response from a custom update\nserver.\n\nCheck out the [WordPress GitHub Release API](https://github.com/wp-forge/worker-wp-github-release-api) repository to\nlearn how to quickly launch a custom update server that fetches releases from GitHub using Cloudflare Workers.\n\n## Plugins\n\nThis package expects your custom plugin info API to respond with the same shape as\nthe [WordPress plugin info API](https://codex.wordpress.org/WordPress.org_API#Plugins). However, if your API response\nhas a different shape, you can map fields to those returned by your API.\n\n### Usage\n\nBasic example:\n\n```php\n\u003c?php\n/**\n * Plugin Name: My Plugin\n */\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse WP_Forge\\WPUpdateHandler\\PluginUpdater;\n\n$url = 'https://my-update-api.com/plugins/plugin-name'; // Custom API GET endpoint\n\nnew PluginUpdater( __FILE__, $url );\n\n```\n\nAdvanced example with data mapping and data overrides:\n\n```php\n\u003c?php\n/**\n * Plugin Name: My Plugin\n */\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse WP_Forge\\WPUpdateHandler\\PluginUpdater;\n\n$file = __FILE__; // Can be absolute path to main plugin file, or the plugin basename.\n$url = 'https://my-update-api.com/plugins/plugin-name'; // Custom API GET endpoint\n\n$pluginUpdater = new PluginUpdater( $file, $url );\n\n/*\n * Keys are the fields that WordPress is expecting (look at the WP Plugin Info API response).\n * Values are the keys returned by your custom API.\n * \n * Use dot notation to map nested keys.\n */\n$pluginUpdater-\u003esetDataMap(\n  [\n    'requires' =\u003e 'requires.wp',          \n    'requires' =\u003e 'requires.php',\n    'banners.2x' =\u003e 'banners.retina',          \n  ]\n);\n\n/*\n *  Explicitly set specific values that will be provided to WordPress.\n */\n$pluginUpdater-\u003esetDataOverrides(\n  [\n    'banners' =\u003e [\n      '2x' =\u003e 'https://my.cdn.com/banner-123-retina.jpg',\n      '1x' =\u003e 'https://my.cdn.com/banner-123.jpg',\n    ],\n    'icons' =\u003e [\n      '2x' =\u003e 'https://my.cdn.com/icon-123-retina.jpg',\n      '1x' =\u003e 'https://my.cdn.com/icon-123.jpg',\n    ],        \n  ]\n);\n\n```\n\n## Themes\n\nThis package expects your custom theme info API to respond with the same shape as\nthe [WordPress theme info API](https://codex.wordpress.org/WordPress.org_API#Themes). However, if your API response has\na different shape, you can map fields to those returned by your API.\n\n### Usage\n\nBasic example:\n\n```php\n\u003c?php\n/**\n * Theme Name: My Theme\n */\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse WP_Forge\\WPUpdateHandler\\ThemeUpdater;\n\n$url = 'https://my-update-api.com/theme/theme-name'; // Custom API GET endpoint\n\nnew ThemeUpdater( wp_get_theme('my-theme'), $url );\n\n```\n\nAdvanced example with data mapping and data overrides:\n\n```php\n\u003c?php\n/**\n * Theme Name: My Theme\n */\n\nrequire __DIR__ . '/vendor/autoload.php';\n\nuse WP_Forge\\WPUpdateHandler\\ThemeUpdater;\n\n$theme = wp_get_theme('my-theme'); // Get the theme's WP_Theme instance.\n$url = 'https://my-update-api.com/themes/theme-name'; // Custom API GET endpoint\n\n$themeUpdater = new ThemeUpdater( $file, $url );\n\n/*\n * Keys are the fields that WordPress is expecting (look at the WP Theme Info API response).\n * Values are the keys returned by your custom API.\n * \n * Use dot notation to map nested keys.\n */\n$themeUpdater-\u003esetDataMap(\n  [\n    'requires' =\u003e 'requires.wp',          \n    'requires' =\u003e 'requires.php',\n    'banners.2x' =\u003e 'banners.retina',          \n  ]\n);\n\n/*\n *  Explicitly set specific values that will be provided to WordPress.\n */\n$themeUpdater-\u003esetDataOverrides(\n  [\n    'banners' =\u003e [\n      '2x' =\u003e 'https://my.cdn.com/banner-123-retina.jpg',\n      '1x' =\u003e 'https://my.cdn.com/banner-123.jpg',\n    ],\n    'icons' =\u003e [\n      '2x' =\u003e 'https://my.cdn.com/icon-123-retina.jpg',\n      '1x' =\u003e 'https://my.cdn.com/icon-123.jpg',\n    ],        \n  ]\n);\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-forge%2Fwp-update-handler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwp-forge%2Fwp-update-handler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwp-forge%2Fwp-update-handler/lists"}