Download the PHP package taproot/micropub-adapter without Composer

On this page you can find all versions of the php package taproot/micropub-adapter. 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 micropub-adapter

taproot/micropub-adapter

Latest Stable Version License Total Downloads

taproot/micropub-adapter is a simple and flexible way to add Micropub support to any PHP web app using PSR-7.

Quick Links

Installation

taproot/micropub-adapter is currently tested against and compatible with PHP 7.3, 7.4, 8.0 and 8.1.

Install taproot/micropub-adapter using composer:

composer.phar require taproot/micropub-adapter
composer.phar install (or composer.phar update)

Versioned releases are GPG signed so you can verify that the code hasn’t been tampered with.

gpg --recv-keys 1C00430B19C6B426922FE534BEF8CE58118AD524
cd vendor/taproot/micropub-adapter
git tag -v v0.1.3 # Replace with the version you have installed

Usage

Subclassing MicropubAdapter

micropub-adapter defines an abstract class, Taproot\Micropub\MicropubAdapter, which implements the request handling logic for micropub and micropub media endpoints. It parses incoming micropub requests and dispatches them to callback methods for each action (create, delete, update, etc.). It handles basic validation and error conditions, normalises incoming data for you, and converts return values from callback methods to valid responses.

All you need to do is subclass MicropubAdapter and implement the relevant callback methods for the actions you want to support. Then, in your app, make an instance of your adapter, and call handleRequest() and handleMediaEndpointRequest() within your micropub and media endpoint requests, respectively.

See the example app for an example of how to subclass and use MicropubAdapter.

Callback Methods

Refer to the API documentation for the paramters and possible return values of each callback. Optional callbacks have a default no-op implementation.

Required for any functionality:

Micropub endpoint action callbacks — implement whichever are relevant for your use-case:

Media Endpoint callbacks — implement to enable the media endpoint. As routing is out of the scope of this library, you’ll have to add a media-endpoint value to the array returned by configurationQueryCallback() in order for clients to be able to discover the media endpoint.

Extension callbacks — these are called after the incoming request is authenticated, but before any micropub-specific handling occurs. This allows your subclass to implement micropub extensions. Implementations of these methods should check to see if a request requires extension handling (e.g. a ?q=source request without a url parameter, which would return an error if handled by the logic surrounding sourceQueryCallback()). If the request requires extension handling, handle it and return a Response or error value. Otherwise, return false to continue handling the request as usual.

Access Tokens and IndieAuth

You’ll need some way of verifying the access tokens used to authenticate micropub requests — indeed, verifyAccessTokenCallback() is the only method which you’re absolutely required to implement! If your app doesn’t yet have IndieAuth endpoints capable of creating and verifying access tokens, you may want to use the companion library taproot/indieauth to add indieauth support to your app. The example app uses taproot/indieauth, so you can refer to that for an example of how to use the two libraries together.

Contributing

If you have any questions about using this library, join the indieweb chatroom and ping barnaby.

If you find a bug or problem with the library, or want to suggest a feature, please create an issue.

If discussions lead to you wanting to submit a pull request, following this process, while not required, will increase the chances of it quickly being accepted:

Changelog

v0.1.3

2023-07-24

(0.1.2 missing due to tagging of incorrect commit)

v0.1.1

2022-10-03

v0.1.0

2021-06-24

Initial release.


All versions of micropub-adapter with dependencies

PHP Build Version
Package Version
Requires psr/http-message Version ^1.0
psr/log Version ^1.1||^2.0||3.0
nyholm/psr7 Version ^1.4
php Version >=7.3
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 taproot/micropub-adapter contains the following files

Loading the files please wait ....