Download the PHP package cuberis/wp-rest-endpoints without Composer

On this page you can find all versions of the php package cuberis/wp-rest-endpoints. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-rest-endpoints

REST API Endpoints for WordPress

Latest Version on Packagist

Add custom REST API endpoints to your WordPress site. This package provides a basic system for adding simple endpoints to the WP REST API.

Requirements

Installing

  1. Install via composer:

  2. Add your desired endpoint(s)
  3. Create your individual result templates for the REST responses (if necessary)

Adding Endpoints

Note: when adding new endpoints, make sure to hook into rest_api_init.

Add Route for Custom Post Type

https://my-website.com/wp-json/cuberis/v1/my-post-type

Extend Base_Controller for a Custom Endpoint

https://my-website.com/wp-json/cuberis/v1/whatever

Templates

Post Type Endpoints

If you are using the default reponse from your post type endpoints, each endpoint will need a template. Templates are PHP files that live in the templates/partials/ directory within your theme. Each template should be named: partial-{post-type-slug}. Example:

If you register multiple post types for an endpoint, the library will look for a partial named partial-all.php.

In your template file, the only thing you will have available from the post will be the ID in the form of an $id variable.

Custom Endpoints

When defining custom endpoints, you have complete control over your API response so you can define if or how you use templates.

About the endpoints

By default, endpoints will return the following JSON format:

id is the raw post ID, title is your post title returned from get_the_title() and html is the raw HTML returned from your template file.

Using URL Parameters

Endpoints are powered by URL parameters which should match up almost identically with WP_Query vars. So for example, you could use:

https://my-website.com/wp-json/cuberis/v1/my-post-type?posts_per_page=4&paged=2&my_category=slug1,slug2

The API would then return posts from the following WP_Query:

Note: Taxonomy queries via endpoints currently only supports the slug field type.

Optional Filters

cuberis_rest_cpt_result

cuberis_rest_api_query_args


All versions of wp-rest-endpoints with dependencies

PHP Build Version
Package Version
Requires php Version >=7
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package cuberis/wp-rest-endpoints contains the following files

Loading the files please wait ....