phil / qa-bundle
Let members answer each other's questions: votes without downvotes, one accepted answer, duplicates closed to a canonical question, Hot sort, reputation.
Package info
github.com/parler-haut-interagir-librement/qa-bundle
Type:symfony-bundle
pkg:composer/phil/qa-bundle
Requires
- php: >=8.5
- ext-mbstring: *
- doctrine/orm: ^3.8
- phil/ranking: ^0.1@dev
- psr/clock: ^1.0
- psr/event-dispatcher: ^1.0
- symfony/clock: ^8.2
- symfony/config: ^8.2
- symfony/dependency-injection: ^8.2
- symfony/uid: ^8.2
Requires (Dev)
- doctrine/dbal: ^4.6
- phil/reputation: ^0.1@dev
- phpunit/phpunit: ^13.4
- symfony/cache: ^8.2
Suggests
- phil/reputation: Recognizes the authors of upvoted and accepted posts in a reputation, through phil_qa.reputation.
Provides
None
Conflicts
None
Replaces
None
This package is auto-updated.
Last update: 2026-12-03 01:33:26 UTC
README
Questions and answers in a Symfony application: votes without votes against, one accepted answer, duplicates closed to their canonical question, a Hot order a database can sort, and the recognition of helpful members.
phil/qa-bundle is a Symfony bundle. A member asks a question in a section — a course, a group, a category —, others answer it and vote for the useful posts, and the author accepts the answer that solved it. Moderators close the questions that repeat another, and the page shows the accepted answer first, then the others by votes.
- Votes for, never against: one vote per member and post, never for one's own; a post nobody finds useful stays low. The count is read again from the votes after each change, so that two votes at once never lose one.
- One accepted answer, by the author of the question or a moderator in their stead; accepting another replaces it.
- Duplicates closed to their canonical question, never to a chain of duplicates; closing reasons a member reads.
- Orders shared with the other community pages: Newest, Active, Unanswered, Top, and Hot — the key of
phil/ranking, stored and refreshed in bounded batches, so that the database sorts; the answers by the Best sort, where a few votes count less than many. - Recognition: a vote or an accepted answer recognizes its author through one interface; with
phil/reputation, it becomes reputation under its daily cap, and withdrawing takes back exactly what was given. - Structured data: the schema.org
QAPageof a page, escaped for its<script>element. - Erasure: an erased member's votes are removed and their posts given to a stand-in, so that the answers of others keep their question.
- Secure and bounded: members are identifiers, never email addresses; titles, bodies, answers per question, listings and batches are bounded; events carry identifiers only; the services hold no state between calls.
Status
| Part | State |
|---|---|
| Questions: asking, revising, closing with reasons, duplicates to the canonical question, reopening, deleting | Implemented and tested |
| Answers: one per member by default, revising, deleting, the accepted answer | Implemented and tested |
| Votes without votes against, and the recognitions they give | Implemented and tested |
| Listings by Newest, Active, Unanswered, Top and Hot; the page with answers by votes | Implemented and tested |
| Stored Hot keys refreshed in batches; one reminder to accept an answer | Implemented and tested |
The schema.org QAPage |
Implemented and tested |
| Forgetting an erased member | Implemented and tested |
phil/reputation integration |
Implemented and tested |
Doctrine and memory stores; the bundle configuration phil_qa |
Implemented and tested |
Documentation
| Document | What it covers |
|---|---|
| Installation | Requirements, installing, the tables, moderation, reputation and the scheduled work. |
| Configuration | Every option, with an example. |
| Questions and answers | Who does what, answers, the accepted answer, closing and duplicates, the pages, structured data, the policy, events, the scheduled work, erasure. |
| Votes and reputation | Votes, the recognitions they give, and phil/reputation. |
| Extension points | The services to replace, the events to listen to, and when they are stable. |
| Testing | The bundle's tests and benchmark, and testing code that uses it. |
| Reference | Every class and service of the bundle. |
Quick start
// config/bundles.php Phil\QaBundle\PhilQaBundle::class => ['all' => true],
# config/packages/phil_qa.yaml phil_qa: moderators: [member-1]
use Phil\QaBundle\Application\Answers; use Phil\QaBundle\Application\QaPages; use Phil\QaBundle\Application\Questions; use Phil\QaBundle\Application\Votes; $question = $questions->ask('member-7', 'course-12', 'How do I read a stack trace?', 'It prints forty lines.'); $answer = $answers->answer($question->id(), 'member-3', 'Read it from the bottom up.'); $votes->vote($answer->id(), 'member-9'); $answers->accept($answer->id(), 'member-7'); $page = $pages->page($question->id()); // the accepted answer first, then the others by votes
Requirements
PHP 8.5 or later with ext-mbstring, Symfony 8.2 or later, and Doctrine ORM 3.8 or later for the Doctrine store.
Contributing
Contributions are welcome on the PHIL monorepo: read the contribution guide and the code of conduct. Report a vulnerability privately, as the security policy explains, never in a public issue.
License
MIT, © Philippe Gamache, doing business as Le Gnome Archiviste; a Parler Haut Interagir Librement project. See LICENSE.