respectify / respectify-php
PHP library for the Respectify API
Requires
- php: >=7.4
- guzzlehttp/psr7: ^2.7
- psr/http-message: ^1.0
- react/event-loop: ^1.1
- react/http: ^1.10
- react/promise: ^3.2
Requires (Dev)
- mockery/mockery: ^1.6
- phpunit/phpunit: ^11.4
- twig/twig: ^3.14.1
- vlucas/phpdotenv: ^5.6
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