PHPackages                             composer/ca-bundle - 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. composer/ca-bundle

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

composer/ca-bundle
==================

Lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.

1.5.10(5mo ago)3.0k346.2M—2.7%40[1 issues](https://github.com/composer/ca-bundle/issues)[2 PRs](https://github.com/composer/ca-bundle/pulls)20MITPHPPHP ^7.2 || ^8.0CI passing

Since Apr 11Pushed 4d ago13 watchersCompare

[ Source](https://github.com/composer/ca-bundle)[ Packagist](https://packagist.org/packages/composer/ca-bundle)[ Fund](https://packagist.com)[ GitHub Sponsors](https://github.com/composer)[ RSS](/packages/composer-ca-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (4)Versions (62)Used By (20)

composer/ca-bundle
==================

[](#composerca-bundle)

Small utility library that lets you find a path to the system CA bundle, and includes a fallback to the Mozilla CA bundle.

Originally written as part of [composer/composer](https://github.com/composer/composer), now extracted and made available as a stand-alone library.

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

[](#installation)

Install the latest version with:

```
$ composer require composer/ca-bundle
```

Requirements
------------

[](#requirements)

- PHP 5.3.2 is required but using the latest version of PHP is highly recommended.

Basic usage
-----------

[](#basic-usage)

### `Composer\CaBundle\CaBundle`

[](#composercabundlecabundle)

- `CaBundle::getSystemCaRootBundlePath()`: Returns the system CA bundle path, or a path to the bundled one as fallback
- `CaBundle::getBundledCaBundlePath()`: Returns the path to the bundled CA file
- `CaBundle::validateCaFile($filename)`: Validates a CA file using openssl\_x509\_parse only if it is safe to use
- `CaBundle::isOpensslParseSafe()`: Test if it is safe to use the PHP function openssl\_x509\_parse()
- `CaBundle::reset()`: Resets the static caches

#### To use with curl

[](#to-use-with-curl)

```
$curl = curl_init("https://example.org/");

$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
if (is_dir($caPathOrFile)) {
    curl_setopt($curl, CURLOPT_CAPATH, $caPathOrFile);
} else {
    curl_setopt($curl, CURLOPT_CAINFO, $caPathOrFile);
}

$result = curl_exec($curl);
```

#### To use with php streams

[](#to-use-with-php-streams)

```
$opts = array(
    'http' => array(
        'method' => "GET"
    )
);

$caPathOrFile = \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath();
if (is_dir($caPathOrFile)) {
    $opts['ssl']['capath'] = $caPathOrFile;
} else {
    $opts['ssl']['cafile'] = $caPathOrFile;
}

$context = stream_context_create($opts);
$result = file_get_contents('https://example.com', false, $context);
```

#### To use with Guzzle

[](#to-use-with-guzzle)

```
$client = new \GuzzleHttp\Client([
    \GuzzleHttp\RequestOptions::VERIFY => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
]);
```

License
-------

[](#license)

composer/ca-bundle is licensed under the MIT License, see the LICENSE file for details.

###  Health Score

78

—

ExcellentBetter than 100% of packages

Maintenance87

Actively maintained with recent releases

Popularity81

Widely adopted with strong download metrics

Community48

Growing community involvement

Maturity82

Battle-tested with a long release history

 Bus Factor2

2 contributors hold 50%+ of commits

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 ~60 days

Recently: every ~8 days

Total

59

Last Release

161d ago

PHP version history (3 changes)1.0.0PHP ^5.3.2 || ^7.0

1.2.0PHP ^5.3.2 || ^7.0 || ^8.0

1.5.0PHP ^7.2 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/b69782e1d7f426ef78f61d159c466a536372eff931f13981ac578fa3f4649352?d=identicon)[Seldaek](/maintainers/Seldaek)

---

Top Contributors

[![Seldaek](https://avatars.githubusercontent.com/u/183678?v=4)](https://github.com/Seldaek "Seldaek (76 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (19 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (11 commits)")[![exussum12](https://avatars.githubusercontent.com/u/1102850?v=4)](https://github.com/exussum12 "exussum12 (11 commits)")[![garas](https://avatars.githubusercontent.com/u/2265694?v=4)](https://github.com/garas "garas (7 commits)")[![peter279k](https://avatars.githubusercontent.com/u/9021747?v=4)](https://github.com/peter279k "peter279k (6 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (5 commits)")[![JanPetterMG](https://avatars.githubusercontent.com/u/11933090?v=4)](https://github.com/JanPetterMG "JanPetterMG (4 commits)")[![carusogabriel](https://avatars.githubusercontent.com/u/16328050?v=4)](https://github.com/carusogabriel "carusogabriel (3 commits)")[![johnstevenson](https://avatars.githubusercontent.com/u/881777?v=4)](https://github.com/johnstevenson "johnstevenson (3 commits)")[![STotev](https://avatars.githubusercontent.com/u/42933860?v=4)](https://github.com/STotev "STotev (2 commits)")[![reedy](https://avatars.githubusercontent.com/u/67615?v=4)](https://github.com/reedy "reedy (2 commits)")[![alcohol](https://avatars.githubusercontent.com/u/21414?v=4)](https://github.com/alcohol "alcohol (2 commits)")[![bytestream](https://avatars.githubusercontent.com/u/1788397?v=4)](https://github.com/bytestream "bytestream (2 commits)")[![jyggen](https://avatars.githubusercontent.com/u/264300?v=4)](https://github.com/jyggen "jyggen (2 commits)")[![tgalopin](https://avatars.githubusercontent.com/u/1651494?v=4)](https://github.com/tgalopin "tgalopin (2 commits)")[![1ma](https://avatars.githubusercontent.com/u/1456708?v=4)](https://github.com/1ma "1ma (2 commits)")[![andreybolonin](https://avatars.githubusercontent.com/u/2576509?v=4)](https://github.com/andreybolonin "andreybolonin (2 commits)")[![thecaliskan](https://avatars.githubusercontent.com/u/13554944?v=4)](https://github.com/thecaliskan "thecaliskan (1 commits)")[![AnrDaemon](https://avatars.githubusercontent.com/u/6532485?v=4)](https://github.com/AnrDaemon "AnrDaemon (1 commits)")

---

Tags

certificatetlssslcabundlecacert

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/composer-ca-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/composer-ca-bundle/health.svg)](https://phpackages.com/packages/composer-ca-bundle)
```

###  Alternatives

[paragonie/certainty

Up-to-date, verifiable repository for Certificate Authorities

2642.4M20](/packages/paragonie-certainty)[kelunik/certificate

Access certificate details and transform between different formats.

11038.3M8](/packages/kelunik-certificate)[kelunik/acme

ACME library written in PHP.

121603.9k3](/packages/kelunik-acme)[kelunik/acme-client

Let's Encrypt / ACME client written in PHP for the CLI.

3933.9k1](/packages/kelunik-acme-client)[sop/crypto-encoding

A PHP implementation of textual encodings of cryptographic structures.

161.4M27](/packages/sop-crypto-encoding)[punkstar/ssl

PHP library for reading and understanding SSL certificates.

1824.3k](/packages/punkstar-ssl)

PHPackages © 2026

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