composer/ca-bundle
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The composer/ca-bundle is a versatile utility library utilized to detect a path to the system Certificate Authority (CA) bundle, thus ensuring efficient communication between servers. As a fallback provision, it features an inclusion to the Mozilla CA bundle. It was initially integrated as part of composer/composer, and as its significance became more prominent, it's now made available as a standalone library.
Usage of the composer/ca-bundle demands a PHP version of 5.3.2 or above, although the latest version is recommended for best performance. Installation of the composer/ca-bundle can be achieved effortlessly with the following command: $ composer require composer/ca-bundle
Once installed, the library provides a set of functions for different usages. Below are some examples demonstrating how to use these functions:
$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);
$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);
$client = new \GuzzleHttp\Client([
\GuzzleHttp\RequestOptions::VERIFY => \Composer\CaBundle\CaBundle::getSystemCaRootBundlePath()
]);
The complete documentation for composer/ca-bundle can be found on its official GitHub page. This resource provides an in-depth look into the usage, installation, requirements, and various examples of how to implement this package. The code is open-source and licensed under the MIT License.