YOURLS/includes/vendor/composer/ca-bundle
Léo Colombaro 4b3ca3f2bd Bump dependencies
- Upgrading composer/ca-bundle (1.3.1 => 1.3.4)
  - Upgrading geoip2/geoip2 (v2.12.2 => v2.13.0)
  - Upgrading ozh/bookmarkletgen (1.2 => 1.2.2)
  - Upgrading pomo/pomo (v1.4.1 => v1.5.0)
  - Upgrading rmccue/requests (2.0.2 => v2.0.5)
  - Upgrading spatie/array-to-xml (2.16.0 => 2.17.1)
  - Upgrading symfony/polyfill-intl-idn (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-intl-normalizer (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-mbstring (v1.25.0 => v1.27.0)
  - Upgrading symfony/polyfill-php72 (v1.25.0 => v1.27.0)
2023-01-07 18:36:41 +01:00
..
res Bump dependencies 2023-01-07 18:36:41 +01:00
src Bump to php 8.1 and drop 7.2, 7.3 (#3230) 2022-02-21 19:53:27 +01:00
LICENSE Upgrade pomo/pomo to 1.4.1 2019-01-08 23:11:24 +01:00
README.md Update deps (#2676) 2020-05-05 18:25:58 +02:00
composer.json Bump to php 8.1 and drop 7.2, 7.3 (#3230) 2022-02-21 19:53:27 +01:00

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.

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

Installation

Install the latest version with:

$ 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.