PHPackages                             civicrm/cv-lib - 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. [CLI &amp; Console](/categories/cli)
4. /
5. civicrm/cv-lib

ActiveLibrary[CLI &amp; Console](/categories/cli)

civicrm/cv-lib
==============

Bootstrap library for CiviCRM CLI tools

v0.3.71(2mo ago)117.6k↓28.8%1MITPHPPHP &gt;=7.4.0

Since Jul 12Pushed 2mo ago5 watchersCompare

[ Source](https://github.com/civicrm/cv-lib)[ Packagist](https://packagist.org/packages/civicrm/cv-lib)[ RSS](/packages/civicrm-cv-lib/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (28)Used By (1)

cv-lib
======

[](#cv-lib)

`cv-lib` is a subpackage provided by `cv`. It defines the essential core of `cv` -- locating and booting CiviCRM.

The canonical home for developing this code is in [civicrm/cv](https://github.com/civicrm/cv). It will be periodically published to the read-only mirror [civicrm/cv-lib](https://github.com/civicrm/cv-lib) to facilitate usage by other projects.

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

[](#installation)

```
composer require civicrm/cv-lib
```

Primary API
-----------

[](#primary-api)

The library provides a handful of supported classes:

- `Civi\Cv\CmsBootstrap` supports the standard boot protocol. In this protocol, we search for a recognized UF/CMS, start that, and then start CiviCRM. The advantage of this protocol is that it is more representative of a typical HTTP-request. (Events and add-ons supported by UF/CMS and CRM will tend to work more normally.)

    Basic usage:

    ```
    Civi\Cv\CmsBootstrap::singleton()->bootCms()->bootCivi();
    ```

    Or you can pass in options:

    ```
    $options = [...];
    Civi\Cv\CmsBootstrap::singleton()
      ->addOptions($options)
      ->bootCms()
      ->bootCivi();
    ```

    End-users may fine-tune the behavior by setting `CIVICRM_BOOT` (as documented in `cv`).
- `Civi\Cv\Bootstrap` supports the legacy boot protocol. In this protocol, we search for `civicrm.settings.php` and start CiviCRM. Finally, we use `civicrm-core` API's to start the associated UF/CMS.

    Basic usage:

    ```
    $options = [...];
    \Civi\Cv\Bootstrap::singleton()->boot($options);
    \CRM_Core_Config::singleton();
    \CRM_Utils_System::loadBootStrap([], FALSE);
    ```

    End-users may fine-tune the behavior by setting `CIVICRM_SETTING` (as documented in `cv`).

Both bootstrap mechanisms accept an optional set of hints and overrides.

For example, by default, `cv-lib` will print errors to STDERR, but you can override the handling of messages:

```
// Disable all output
$options['log'] = new \Psr\Log\NullLogger();

// Enable verbose logging to STDOUT/STDERR
$options['log'] = new \Civi\Cv\Log\StderrLogger('Bootstrap', TRUE);

// Use bridge between psr/log and symfony/console
$options['log'] = new \Symfony\Component\Console\Logger\ConsoleLogger($output);

// Use the console logger from cv cli. (Requires symfony/console. Looks a bit prettier.)
public function execute(InputInterface $input, OutputInterface $output) {
  ...
  $options['output'] = $output;
  ...
}
```

For more info about `$options`, see the docblocks.

Experimental API
----------------

[](#experimental-api)

Other classes are included, but their contracts are subject to change. These include higher-level helpers for building Symfony Console apps that incorporate Civi bootstrap behaviors.

- `BootTrait` has previously suggested as an experimentally available API (circa v0.3.44). It changed significantly (circa v0.3.56), where `configureBootOptions()` was replaced by `$bootOptions`, `mergeDefaultBootDefinition()`, and `mergeBootDefinition()`.
- As an alternative, consider the classes `BaseApplication` and `CvCommand` if you aim to build a tool using Symfony Console and Cv Lib.

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance88

Actively maintained with recent releases

Popularity28

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 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

Every ~38 days

Total

27

Last Release

60d ago

PHP version history (2 changes)v0.3.44PHP &gt;=7.3.0

v0.3.66PHP &gt;=7.4.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1336047?v=4)[Tim Otten](/maintainers/totten)[@totten](https://github.com/totten)

---

Top Contributors

[![totten](https://avatars.githubusercontent.com/u/1336047?v=4)](https://github.com/totten "totten (24 commits)")

### Embed Badge

![Health badge](/badges/civicrm-cv-lib/health.svg)

```
[![Health](https://phpackages.com/badges/civicrm-cv-lib/health.svg)](https://phpackages.com/packages/civicrm-cv-lib)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.1k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)[codedungeon/php-cli-colors

Liven up you PHP Console Apps with standard colors

10210.1M26](/packages/codedungeon-php-cli-colors)

PHPackages © 2026

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