Condorcet
Versatile PHP election engine (library & CLI) with a high-level API. Handles everything from the simplest use cases to advanced options and simulation tools. Supports 20+ native Condorcet-like voting methods (extensible), scales from small polls to billions of votes in resource-constrained environments. Rigorously tested and documented.
Install / Use
/learn @julien-boudry/CondorcetREADME
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.
:ballot_box: Also discover Condorcet Desktop — a graphical app to run elections without any code, also available online at desktop.condorcet.vote
Condorcet PHP<!-- {docsify-ignore-all} -->
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:
- Command Line Application: For quick access to essential features without technical expertise. Easily compute election results and statistics.
- PHP Library: Integrate into your code to access all advanced features (custom manipulations, extensions, performance optimizations, advanced I/O methods, etc.).
Both approaches can handle massive numbers of votes (hundreds of millions) on modest hardware.
Summary
- Condorcet PHP
Project State and Specifications
| 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.
Supported Voting Methods
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 provided natively
Single-winner methods return a complete ranking of all candidates.
Deterministic
Condorcet / Borda (+ Nauru variant) / Copeland / Dodgson (2 Approximations) / FPTP / Instant-runoff (alternative vote) / Kemeny–Young / Minimax (+ variants) / Ranked Pairs (+ variants) / Schulze (+ variants)
Lotteries
Random Ballot / Random Candidates
Proportional Methods provided natively
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)
Add your own voting method as a module
Condorcet features a modular architecture allowing easy extension with new algorithms:
Main Features
-
Complete Election Management
- Handle the full election cycle: candidate registration, vote collection, result calculation
- Support for vote ordering, tagging, deletion, and result simulation
- Multiple input formats (string, JSON, objects)
- Import/export support for Condorcet Election Format, Debian Format, David Hill Format
- Integrity verification through checksumming
- Serialization and data export for storage
- User-friendly features (vote validation, anti-spam, human-readable results)
-
Comprehensive Results and Statistics
- Identify Condorcet Winners, Losers, and Paradoxes
- Generate complete rankings using various voting methods
- Detailed statistical analysis of results
- Support for both complete and partial ballot rankings
- Vote weighting capabilities
-
Advanced Capabilities
- Object-oriented design for flexibility and extendability
- Dynamic candidate and vote management across multiple elections (simulate election easily)
- External storage drivers for handling massive elections
- Intelligent caching system (performance optimization)
- Vote constraints
-
Extensibility and Configuration
- Extend functionality without modifying core code
- Create custom vote methods, constraints, and storage drivers
- Extensive configuration options
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.
Use Condorcet as a command line application
Install as a command line application
Available installation methods:
- Native installation from source with Composer
- Standalone PHAR executable file
- Docker image (build or pull)
Condorcet Book - Command Line
- Usage Examples
- [Command Reference](https://docs.condorcet.io/book/2.AsComm
Related Skills
openhue
338.0kControl Philips Hue lights and scenes via the OpenHue CLI.
sag
338.0kElevenLabs text-to-speech with mac-style say UX.
weather
338.0kGet current weather and forecasts via wttr.in or Open-Meteo
tweakcc
1.4kCustomize Claude Code's system prompts, create custom toolsets, input pattern highlighters, themes/thinking verbs/spinners, customize input box & user message styling, support AGENTS.md, unlock private/unreleased features, and much more. Supports both native/npm installs on all platforms.
