Skip to content

pabamato/discovery-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WordPress API Discovery

This library allows autodiscovery of the WordPress REST API shipping in WordPress 4.4.

Installing

This library should be installed via Composer as wp-api/discovery.

If manually installing (i.e. via git clone), be sure to run composer install after cloning the code.

Using

The main entry point is the WordPress\Discovery\discover() function. Simply pass in a URL to discover the API.

/**
 * Discover the WordPress API from a URI.
 *
 * @param string $uri URI to start the search from.
 * @param bool $legacy Should we check for the legacy API too?
 * @return Site|null Site data if available, null if not a WP site.
 */
function discover( $uri, $legacy = false ) {

This project also includes a demo web install:

php -S 0.0.0.0:9000 www/index.php

Then access http:https://localhost:9000/ to view the demo. It looks something like this:

License

This project is licensed under the MIT license. See LICENSE.md for the full license.

About

Library for discovering the WordPress REST API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 85.7%
  • CSS 14.3%