Condorcet PHP

From electowiki

Condorcet PHP is a command-line application and a software library written in PHP8 and distributed open-source. It is designed to manage and compute an election (candidates, votes, results) with many options, and natively implements many voting methods.
Its interface is designed to offer both high-level methods: simple to understand and use. As well as more technical approaches allowing numerous settings and extensions.

Condorcet PHP is designed to work with good performances, but especially quasi-linear performances, allowing to manage billions of votes on a small machine. It is also suitable for use in simulations and other statistical work, thanks to full computational details for each voting method.

Voting methods included natively & Implementation Philosophy

As of July 2022, the application is provided natively with 22 different voting methods (+ some options allowing variants). Most of them are "single winner" methods although a complete ranking is usually provided, it also includes proportional methods, (STV, CPO-STV, Largest remainder, Highest Average....). The full list is available on the documentation.

As input, the ballots are in the form of candidate rankings which allows the implementation of all preferential voting methods but does not allow methods like majority judgment or most of the score voting methods. However, by extension, it allows the inclusion of methods like FTPT (which is included natively), the implementation choice being then to keep only the first expressed rank (without ties).

Condorcet PHP has the particularity that distinguishes itself from most other software by its philosophy about ties on ballot input and ties on result output because it will try to serve both. Also, Condorcet will try to output a full ranking even with single-winner methods. This must however be completed by the specificities and the documentation of each method because it's come from the interpretation and implementation choices from original papers, other implementations can be more strict or different on some methods.

Two versions for two different types of user

  • Usage as a command-line application allows usage without complicated technical skills, in particular with the official Docker image, but not strictly as simple as a traditional or web application.
  • Usage as a software library gives access to much more complete parameterization and management, with different levels of abstraction. The modular and open architecture allows the creation of additional voting methods, custom validation methods, or extends the source code.

Advanced or original features

  • Vote weight management, allowing to give more weight to one or more votes
  • Management of tags and metadata on a vote, then sort, delete, and use them
  • Management of ties on ballots, and in results (for compatible methods)
  • Constraint management (ignore votes that don't meet the criteria. For example, prohibit ties on a rank).
  • Implicit interpretation of votes (unspecified candidates are assumed to be tied on the last row) or explicit (unspecified candidates on a ballot are ignored).
  • Details of calculations for each voting method
  • Ballot management in technical formats (objects, array, Json...) or user-friendly formats.
  • Export of results in technical (objects, array, Json) or user-friendly formats.
  • Ability to compute billions of votes with domestic hardware.
  • Compatibility with the Condorcet Election Format (import/export), David Hill Format (import), and Debian Format (import).


Condorcet is not audited[1], implementations of voting methods are not proven and come without any warranty. And it can be very liberal or original in his implementation choices.
However, more than 1100 unit and functional tests have been written to check the general stability. These tests include many elections, including - for each method - many examples quoted on Electowiki, Wikipedia, or from official papers of the theorists of each method or from referring authorities. Election data & results tests can be consulted on the dedicated folder, and news tests can be submitted.

It is not known any use of professional or legal importance of Condorcet PHP. No serious usage facts are known. It is most often used in small associations or courtesy decisions.

External Links

  1. as of July 2022