2017 © Pedro Peláez
 

library ca-bundle

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

image

composer/ca-bundle

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

  • Thursday, March 29, 2018
  • by Seldaek
  • Repository
  • 17 Watchers
  • 710 Stars
  • 19,029,821 Installations
  • PHP
  • 53 Dependents
  • 6 Suggesters
  • 14 Forks
  • 1 Open issues
  • 13 Versions
  • 15 % Grown

The README.md

composer/ca-bundle

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

Originally written as part of composer/composer, now extracted and made available as a stand-alone library., (*2)

Installation

Install the latest version with:, (*3)

$ composer require composer/ca-bundle

Requirements

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

Basic usage

Composer\CaBundle\CaBundle

  • 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

$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

$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

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

License

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

The Versions

29/03 2018

dev-master

9999999-dev

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

  Sources   Download

MIT

The Requires

  • php ^5.3.2 || ^7.0
  • ext-openssl *
  • ext-pcre *

 

The Development Requires

ssl certificate tls cabundle cacert

29/03 2018

1.1.1

1.1.1.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

29/11 2017

1.1.0

1.1.0.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

13/11 2017

1.0.9

1.0.9.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

11/09 2017

1.0.8

1.0.8.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

06/03 2017

1.0.7

1.0.7.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

02/11 2016

1.0.6

1.0.6.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

02/11 2016

1.0.5

1.0.5.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

04/09 2016

1.0.4

1.0.4.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

19/07 2016

1.0.3

1.0.3.0

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

  Sources   Download

MIT

The Requires

  • ext-openssl *
  • ext-pcre *
  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

13/04 2016

1.0.2

1.0.2.0

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

  Sources   Download

MIT

The Requires

  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

11/04 2016

1.0.1

1.0.1.0

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

  Sources   Download

MIT

The Requires

  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert

11/04 2016

1.0.0

1.0.0.0

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

  Sources   Download

MIT

The Requires

  • php ^5.3.2 || ^7.0

 

The Development Requires

ssl certificate tls cabundle cacert