Download the PHP package calderawp/rest-api without Composer

On this page you can find all versions of the php package calderawp/rest-api. 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 rest-api

Caldera REST API

This is the forms package of the Caldera Framework and provides REST API functionality to the framework.

This Is Not Caldera Forms.

Overview

This package is primarily responsible for:

It is important to note that this package does not provide for form processing, or entry saving. This package should be a router only. It dispatches a serious of events - via the CalderaHttp module. Those events are used to

The Request and Response objects extend objects from the Http package. You should probably read that package's README before completing this README.

Usage

Install

Overview

Main module class methods:

To add a route, you create one or more endpoints, add them to a route and then register the route with the module class's addRoute() method. This is explained in more detail below.

Using

Defining An Endpoint

Endpoints MUST implement the calderawp\interop\Contracts\Rest\Endpoint interface. This module has a Endpoint abstract class that provides most of the required methods. It is recommended to extend that class when creating an endpoint.

An endpoint represents a single entry point for the REST API. The endpoint class defines the endpoints rules and routes the request to wherever the business logic of the request lives -- probably the route.

When extending Endpoint, you have to add three methods to concrete class:

Defining A Route

Endpoints MUST implement the calderawp\caldera\restApi\Contracts interface. This module has a Route abstract class that provides most of the required methods. It is recommended to extend that class when creating aroute.

An route represents a group of endpoints with the same base URL -- /forms and /forms/<form-id> -- are endpoints of the same route.

When extending Route, you have to add three methods to concrete class:

Routes MUST have an addEndpoint(Endpoint $endpoint): Route method. You can use this to add one or more endpoints to your route:

Make Your Route Do Something

The handleRequest() method of the endpoint, should send the request, when valid to your route. In your route, you can have business logic if its testable there. In the form API, I used another layer of abstraction -- a controller to make testing and reuse easier. That may or may not be too complex. When making your own endpoints, question if that extra layer of abstraction solves any actual problems.

Connecting To The WordPress REST API

The WordPress plugin in mu-plugins has a trait that can be used to register these endpoint/ routes with WordPress. The README for that plugin explains more.

Using With A Standards-Friendly PHP Framework

The calderawp/http package already has conversion from Caldera HTTP request/responses and PSR-7 request/responses. So it should not be hard to use this REST API with a PHP framework such as Slim. I fully intend to make a trait like the one I did in WordPress to handle that logic.

Making A Remote HTTP Request From An Endpoint Callback

It is not uncommon for a REST API route to act as a proxy for a 3rd-party API. For example, a request to a Caldera endpoint might cause the system to find Stripe credentials, use them to query the Stripe API and then return formatted results to the client. In this case an HTTP request must be made on the server. This request MUST be made using the calderawp/http package. See that package's README for more info.

Sending Responses

WordPress JWT Authentication

See

Testing

License, Copyright, etc.

Copyright 2018+ CalderaWP LLC and licensed under the terms of the GNU GPL license. Please share with your neighbor.


All versions of rest-api with dependencies

PHP Build Version
Package Version
Requires php Version ^7.2
firebase/php-jwt Version ^5.0
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 calderawp/rest-api contains the following files

Loading the files please wait ....