Skip to content

Latest commit

 

History

History
182 lines (129 loc) · 2.76 KB

README.md

File metadata and controls

182 lines (129 loc) · 2.76 KB

WordPress.org API Client

Client for retrieving information from the WordPress.org API. Documentation for the WordPress.org API is located here.


Installation

composer require camrymps/wordpress.org-api

Getting Started

use WordPressOrgApi\WordPress as WordPressClient;

$client = new WordPressClient;
$client = new WordPressClient(true); // Returns all responses as associative arrays (optional)

Usage

checkVersion()

Returns information on currently supported Wordpress versions.

$client->checkVersion();

searchThemes([$params])

Returns a list of themes with their associated information.

$client->searchThemes();
$client->searchThemes([
    "search" => "foo",
    "fields" => [
        "description" => true
    ]
]);

getTheme($slug[, $params])

Returns information about a specific theme.

$client->getTheme("twentyseventeen");
$client->getTheme("twentyseventeen", [
    "fields" => [
        "description" => true
    ]
]);

getHotThemeTags([$params])

Returns a list of the most popular theme tags.

$client->getHotThemeTags()
$client->getHotThemeTags([
    "number" => 10
]);

getThemeFeatureList()

Returns a list of valid theme tags.

$client->getThemeFeatureList();

searchPlugins([$params])

Returns a list of plugins with their associated information.

$client->searchPlugins();
$client->searchPlugins([
    "search" => "foo",
    "fields" => [
        "description" => true
    ]
]);

getPlugin($slug[, $params])

Returns information about a specific plugin.

$client->getPlugin("jetpack");
$client->getPlugin("jetpack", [
    "fields" => [
        "description" => true
    ]
]);

getHotPluginTags([$params])

Returns a list of the most popular plugin tags.

$client->getHotPluginTags();
$client->getHotPluginTags([
    "number" => 10
]);

getPopularImportPlugins()

Returns a list of popular import plugins in the WordPress Plugin Directory.

$client->getPopularImportPlugins();

Parameters

For an in-depth list of parameters that can be used with the methods above, please refer to the Wordpress.org API located here.


Async

All methods can be used asynchronously simply by adding "Async" to the end of the method name. For example:

$promise = $client->getThemeAsync("twentyseventeen");

$promise->then(
    function($theme) {
        var_dump($theme);
    }
);