respectify/respectify-php

PHP library for the Respectify API

v0.2.17 2025-03-29 22:28 UTC

This package is auto-updated.

Last update: 2025-05-29 22:53:37 UTC


README

PHP library for the Respectify API. Respectify aims to improve internet discussions: encourage healthy, understanding discussion in comments and replies.

Getting started

This contains the Respectify client, which is currently available only as an asychronous API using ReactPHP.

Check out src/RespectifyClientAsync.php. For info on the REST API that it wraps, have a look here.

Developing

To be able to make changes:

$ brew install php
$ brew install composer

If you want to run unit tests:

$ composer require --dev phpunit/phpunit mockery/mockery vlucas/phpdotenv

and then to run tests:

$ vendor/bin/phpunit --bootstrap vendor/autoload.php tests

Tests are run against mocks, but there is value in running against the real API. Do do this create a tests/.venv file, with content:

USE_REAL_API=true
RESPECTIFY_EMAIL=you@example.com
RESPECTIFY_API_KEY=your-api-key-here
REAL_ARTICLE_ID=an-existing-article-id-here

using real Respectify credentials.

Docs

Docs are generated in Markdown format for Docusaurus via the phpdocumentor-markdown-customised phpdoc theme. It is MIT-licensed. Please see the readme in that folder for more information.

You'll need twig and php-documentor installed (install the dev dependencies.)

If you have a phpdoc command available (eg, set up as a Docker container):

$ alias phpdoc="docker run --rm -v \"$(pwd)\":/data phpdoc/phpdoc:3"

then you can general doc like so:

# Run phpDocumentor with --template argument pointed to markdown template
$ phpdoc --directory=src --target=docs --template="phpdocumentor-markdown-customised/themes/markdown" --title="Respectify PHP Library" -c phpdoc.xml