PHPackages                             ankane/cbc - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. ankane/cbc

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

ankane/cbc
==========

Mixed-integer programming for PHP

v0.1.0(1mo ago)10EPL-2.0PHPPHP &gt;= 8.2CI passing

Since Apr 14Pushed 1mo agoCompare

[ Source](https://github.com/ankane/cbc-php)[ Packagist](https://packagist.org/packages/ankane/cbc)[ RSS](/packages/ankane-cbc/feed)WikiDiscussions master Synced 1w ago

READMEChangelogDependencies (1)Versions (2)Used By (0)

Cbc PHP
=======

[](#cbc-php)

[Cbc](https://github.com/coin-or/Cbc) - the mixed-integer programming solver - for PHP

[![Build Status](https://github.com/ankane/cbc-php/actions/workflows/build.yml/badge.svg)](https://github.com/ankane/cbc-php/actions)

Installation
------------

[](#installation)

First, install Cbc. For Homebrew, use:

```
brew install cbc
```

And for Ubuntu, use:

```
sudo apt-get install coinor-libcbc-dev
```

Then run:

```
composer require ankane/cbc
```

Getting Started
---------------

[](#getting-started)

*The API is fairly low-level at the moment*

Load a problem

```
$model = Cbc\Model::loadProblem(
    sense: Cbc\Sense::Minimize,
    start: [0, 3, 6],
    index: [0, 1, 2, 0, 1, 2],
    value: [2, 3, 2, 2, 4, 1],
    colLower: [0, 0],
    colUpper: [1e30, 1e30],
    obj: [8, 10],
    rowLower: [7, 12, 6],
    rowUpper: [1e30, 1e30, 1e30],
    colType: [Cbc\ColType::Integer, Cbc\ColType::Continuous]
);
```

Solve

```
$model->solve();
```

Write the problem to an LP or MPS file

```
$model->writeLp('hello.lp');
// or
$model->writeMps('hello'); // adds .mps.gz
```

Read a problem from an LP or MPS file

```
$model = Cbc\Model::readLp('hello.lp');
// or
$model = Cbc\Model::readMps('hello.mps.gz');
```

Reference
---------

[](#reference)

Set the log level

```
$model->solve(logLevel: 1); // 0 = off, 3 = max
```

Set the time limit in seconds

```
$model->solve(timeLimit: 30);
```

History
-------

[](#history)

View the [changelog](https://github.com/ankane/cbc-php/blob/master/CHANGELOG.md)

Contributing
------------

[](#contributing)

Everyone is encouraged to help improve this project. Here are a few ways you can help:

- [Report bugs](https://github.com/ankane/cbc-php/issues)
- Fix bugs and [submit pull requests](https://github.com/ankane/cbc-php/pulls)
- Write, clarify, or fix documentation
- Suggest or add new features

To get started with development:

```
git clone https://github.com/ankane/cbc-php.git
cd cbc-php
composer install
composer test
```

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance89

Actively maintained with recent releases

Popularity2

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity36

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

57d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/220358?v=4)[Andrew Kane](/maintainers/ankane)[@ankane](https://github.com/ankane)

---

Top Contributors

[![ankane](https://avatars.githubusercontent.com/u/220358?v=4)](https://github.com/ankane "ankane (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/ankane-cbc/health.svg)

```
[![Health](https://phpackages.com/badges/ankane-cbc/health.svg)](https://phpackages.com/packages/ankane-cbc)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
