Command line application & PHP library providing a powerful, simple and complete election manager. Native support for many voting methods like Schulze / Ranked Pairs / Kemeny-Young / Minimax / Borda / Instant-runoff / FTPT / Copeland... Modular architecture can be easily extended. Able to support billions of votes on a low-resource environment.
Main Author: Julien Boudry
License: MIT - Please say hello if you like or use this code!
Contribute: Contribution File
Donation: ₿ bc1q3jllk3qd9fjvvuqy07tawkv7t6h7qjf55fc2gh or GitHub Sponsor Page
You can also offer me a bottle of good wine.
Presentation | Documentation Book | API Reference | Voting Methods | Tests
Condorcet is a powerful engine for managing electoral processes and calculating election results. It handles all aspects from configuration and vote collection to result calculation. The library natively implements over 20 voting methods compatible with preferential voting ballots, including Condorcet methods, Alternative Voting, STV, and many others.
=> See all supported voting methods
Two ways to use Condorcet:
Both approaches can handle massive numbers of votes (hundreds of millions) on modest hardware.
Version | PHP Requirements | State | Support |
---|---|---|---|
5.0 | 8.4 | Stable | ✔ support provided |
4.7 | 8.3 | Old Stable | ✔ support provided |
4.6 | 8.2 | Old Stable | ❌ not any support |
3.x | 8.1 | Old Stable | ❌ not any support |
2.2 | 7.4 | Old Stable | ❌ support requiring some incentive |
2.0 | 7.1 | Old Stable | ❌ not any support |
1.0 | 5.6 | Old Stable | ❌ not any support |
0.9x | 5.5 | Old Stable | ❌ ℹ Since v0.90, you should consider then it’s a new project (api, engine). |
0.14 | 5.5 | Old Stable | ❌ ready for the museum |
All versions require Json and Mbstring extensions (or polyfill). Pdo-Sqlite is recommended for elections with hundreds of thousands of votes or more.
Condorcet supports both “single-winner” methods (with full ranking extrapolation) and proportional representation systems.
Full details on voting methods, options, and implementation choices
Single-winner methods return a complete ranking of all candidates.
Condorcet / Borda (+ Nauru variant) / Copeland / Dodgson (2 Approximations) / FPTP / Instant-runoff (alternative vote) / Kemeny–Young / Minimax (+ variants) / Ranked Pairs (+ variants) / Schulze (+ variants)
Random Ballot / Random Candidates
Methods designed for electing multiple candidates to an assembly.
Single Transferable Vote (STV) / Comparison of Pairs of Outcomes by the Single Transferable Vote (CPO-STV) / Highest Averages Methods (Sainte-Laguë, Jefferson/D’Hondt, and variants) / Largest Remainder Methods (with different quotas)
Condorcet features a modular architecture allowing easy extension with new algorithms:
Complete Election Management
Comprehensive Results and Statistics
Advanced Capabilities
Extensibility and Configuration
Although not primarily designed for maximum performance, Condorcet delivers predictable, linear scaling even with very large elections. While not formally certified, comprehensive test coverage ensures reliable results.
Available installation methods:
Uses namespace \CondorcetPHP\Condorcet
Installation options:
The documentation includes comprehensive examples illustrating the library’s capabilities.
Overview Examples:
HTML Output Examples:
Specific Examples:
The codebase follows PSR-12 with some flexibility, enforced via CS-Fixer throughLaravel Pint.
Performance varies significantly between voting methods. See method benchmarks.
Kemeny-Young Performance:
Large Elections:
For elections with 50,000+ votes, consider external storage to avoid memory constraints. Condorcet includes a PDO driver that works with standard relational databases to handle hundreds of millions of votes. A simple SQLite implementation is provided.
Custom storage drivers can be implemented for NoSQL or other storage systems.
See the documentation on handling large elections
Benchmarks run on a modern Linux x64 system with PHP 8.1 (CLI).