Download the PHP package arafatkn/wrest without Composer
On this page you can find all versions of the php package arafatkn/wrest. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download arafatkn/wrest
More information about arafatkn/wrest
Files in arafatkn/wrest
Package wrest
Short Description WREST - easy to use REST API wrapper for WordPress
License MIT
Homepage https://github.com/arafatkn/wrest
Informations about the package wrest
WREST (WordPress REST)
WREST - easy to use fluent REST API wrapper for WordPress.
Installation
Requirements
- PHP >= 5.6
- WordPress >= 4.4
You can install wRest in two ways, via composer and manually.
1. Composer Installation
Add dependency in your project (theme/plugin):
Now add autoload.php
in your file if you haven't done already.
2. Manual Installation
Not Available Yet.
Usage
WordPress API needs a namespace, so you have to set a namespace first.
One way is to set a default namespace before creating routes.
or you can set namespace for a group of routes.
Passed callback will get a WP_REST_Request
object as a parameter.
More Examples
Permission Management
Passing a capability
Passing a callback
Parameters passing
If you do not pass a regex for a param then [^/]+
will be used as default.
Route Action
Action can be a callback, a class method, a static class method or a non-static class method and can be passed as below.
All the functions will get a WP_REST_Request
object as a parameter.
Supported Features
- [x] Namespaces for All Routes.
- [x] Normal Routes.
- [x] Routes with Parameters.
- [x] Route Actions.
- [x] Permission Management.
Upcoming Features
- [ ] Add support for route groups.
- [ ] Add support for namespace on the fly.
- [ ] Add support for namespace groups.
- [ ] Add support for resource routes.
- [ ] Add support for schema.
- [ ] Add support route redirection.
- [ ] Add support for passing matched parameters directly to actions.
Credits
Special thanks to Tareq Hasan for this awesome idea.
Contribution Guide
This is still in beta, though I have a confidence that it will work as expected. You can contribute by reporting bugs, fixing bugs, reviewing pull requests and more ways. Go to issues section, and you can start working on a issue immediately. If you want to add or fix something, open a pull request.
License
The MIT License (MIT). Please see License File for more information.