Composer Require 'package' throws OpenSSL error

Clash Royale CLAN TAG#URR8PPPComposer Require 'package' throws OpenSSL error
This problem seems to be common, and i've been through a lot of SO posts related to it and nothing works, and i'm going crazy.
Setup :
What Works :
What does not work :
Installing a package
I cannot reach https://packagist.org/ with firefox (unsecure connection)
The error i get with composer require :
[ComposerDownloaderTransportException]
The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
php -r "var_dump(openssl_get_cert_locations());" Returns this :
array(8) {
["default_cert_file"]=>
string(25) "c:/usr/local/ssl/cert.pem"
["default_cert_file_env"]=>
string(13) "SSL_CERT_FILE"
["default_cert_dir"]=>
string(22) "c:/usr/local/ssl/certs"
["default_cert_dir_env"]=>
string(12) "SSL_CERT_DIR"
["default_private_dir"]=>
string(24) "c:/usr/local/ssl/private"
["default_default_cert_area"]=>
string(16) "c:/usr/local/ssl"
["ini_cafile"]=>
string(51) "C:/wamp64/bin/php/php7.1.9/extras/ssl/ca-bundle.crt"
["ini_capath"]=>
string(0) ""
}
I've downloaded the ca-bundle.crt and added it to my php.ini file :
curl.cainfo=C:/wamp64/bin/php/php7.1.9/extras/ssl/ca-bundle.crt
openssl.cafile=C:/wamp64/bin/php/php7.1.9/extras/ssl/ca-bundle.crt
Composer diagnose returns this :
Checking composer.json: OK
Checking platform settings: OK
Checking git settings: OK
Checking http connectivity to packagist: WARNING
[ComposerDownloaderTransportException] The "http://packagist.org/packages.json" file could not be downloaded (HTTP/1.1 404 Not Found)
Checking https connectivity to packagist: WARNING
[ComposerDownloaderTransportException] The "https://packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed
Failed to enable crypto
failed to open stream: operation failed
Checking github.com rate limit: OK
Checking disk free space: OK
Checking pubkeys: OK
Checking composer version: OK
Composer version: 1.6.5
PHP version: 7.1.9
PHP binary path: C:wamp64binphpphp7.1.9php.exe
composer show -p -vvv | grep ssl returns this :
Reading ./composer.json
Loading config file ./composer.json
Checked CA file C:wamp64binphpphp7.1.9extrassslca-bundle.crt: valid
Executing command (C:wamp64wwwprojectName): git branch --no-color --no-abbrev -v
Failed to initialize global composer: Composer could not find the config file: C:/Users/********/AppData/Roaming/Composer/composer.json
To initialize a project, please create a composer.json file as described in the https://getcomposer.org/ "Getting Started" section
Reading C:wamp64wwwprojectName/vendor/composer/installed.json
Loading plugin PackageVersionsInstaller
Loading plugin SymfonyFlexFlex
Composer >=1.7 not found, downloads will happen in sequence
Running 1.6.5 (2018-05-04 11:44:59) with PHP 7.1.9 on Windows NT / 10.0
ext-openssl 7.1.9 The openssl PHP extension
lib-openssl 1.0.2.11 OpenSSL 1.0.2k 26 Jan 2017
php --ini :
Configuration File (php.ini) Path: C:WINDOWS
Loaded Configuration File: C:wamp64binphpphp7.1.9php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed: (none)
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
I am able to access packagist.org without any errors...
– Bogdan Burim
44 secs ago