Download the PHP package hitrov/oci-api-php-request-sign without Composer
On this page you can find all versions of the php package hitrov/oci-api-php-request-sign. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package oci-api-php-request-sign
Oracle Cloud Infrastructure API requests sign with PHP
- Installation
- Preparing credentials
- Basic usage
- Alternatives for providing credentials
- Constructor arguments
- Separate credentials class
- Manual generation steps
- Inspiration
If you prefer article style, here's a link to Medium
Installation
Import classes autoloader
Preparing credentials
Signer
expects a list of environment variables available:
There are few more ways to expose/pass them, please refer to this section.
Basic usage
Here's the example of PHP script on how to CreatePreauthenticatedRequest for Object Storage Service API.
That's it!
Alternatives for providing credentials
Constructor arguments
Separate credentials class
Implement Hitrov\OCI\KeyProvider\KeyProviderInterface
methods
public function getPrivateKey(): string;
// must return a string (contents of privatekey.pem)public function getKeyId(): string;
// must return a string like"{OCI_TENANCY_ID}/{OCI_USER_ID}/{OCI_KEY_FINGERPRINT}"
Force Signer
to use it instead of constructor arguments and environment variables:
There's such an example covered in Unit tests tests\Hitrov\Test\MockKeyProvider.php
Manual generation steps
There are more public methods exposed for all the stuff generated behind the scenes if you need it or just curious how it works:
Authorization header is being generated this way (version is always 1
for this signing procedure):
Authorization: Signature version=\"1\",keyId=\"{KEY_ID}\",algorithm=\"rsa-sha256\",headers=\"{SIGNING_HEADERS_NAMES_STRING}\",signature=\"{SIGNATURE}\"
Inspiration
All versions of oci-api-php-request-sign with dependencies
ext-openssl Version *