gigya / php-sdk
PHP SDK for Gigya
Installs: 419 438
Dependents: 3
Suggesters: 0
Security: 0
Stars: 8
Watchers: 6
Forks: 13
Open Issues: 5
pkg:composer/gigya/php-sdk
Requires
- php: >=8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
- firebase/php-jwt: ^6.0
Requires (Dev)
- phpunit/phpunit: ^8.5
- dev-main
- 3.0.7
- 3.0.6
- 3.0.5
- 3.0.4
- 3.0.2
- 3.0
- dev-us/CXCDC-35465-PHP-SDK-MTLS-support
- dev-Reuse-Migration-TOML-Branch
- dev-allow_empty_apikey_requests
- dev-fix_key_typing_error
- dev-update_digicert_certificate_authority
- dev-fix_version_numbering
- dev-rem_utf8_encode_php82
- dev-firebase_jwt_6_compat
- dev-master
- dev-us/00000_pii_fix_and_versioning
- dev-us/116419_sensitive_info_fix
This package is auto-updated.
Last update: 2025-12-10 13:58:00 UTC
README
Description
The PHP SDK provides a PHP interface for the Gigya API. The library makes it simple to integrate Gigya services in your PHP application.
Requirements
PHP 8.0.x, PHP 8.1.x, PHP 8.2.x
Download and Installation
Standalone
- Clone the repo.
- Run
composer update.
In a project
- Run
composer config repositories.gigyaphpsdk git https://github.com/SAP/gigya-php-sdk.git - Run
composer require gigya/php-sdk
It will now be possible to autoload Gigya PHP SDK: use Gigya\PHP.
Note: If the project does not use Composer natively / as part of a framework, it is necessary to include vendor/autoload.php in your project.
Configuration
- Obtain a Gigya APIKey and authentication details.
- Follow the installation instructions above.
- Start using according to documentation.
mTLS Authentication
The SDK supports mutual TLS (mTLS) authentication using client certificates. This provides an additional layer of security by authenticating both the client and server.
Basic Usage with Certificate Files
use Gigya\PHP\GSRequest; $request = new GSRequest( null, // apiKey (optional with mTLS) null, // secretKey (optional with mTLS) 'accounts.getAccountInfo', null, true, // useHTTPS (required for mTLS) null ); $request->setAPIDomain('us1.gigya.com'); // Set client certificate (file paths) $request->setClientCertificate( 'certs/client.pem', // Path to certificate file 'certs/client.key', // Path to private key file 'password' // Optional: password if key is encrypted ); $response = $request->send();
Example with Certificate Content (Strings)
You can also provide certificate and key content directly as strings, which is useful when loading from environment variables or secure storage:
// Load certificates from files or environment variables $certContent = file_get_contents('certs/client.pem'); $keyContent = file_get_contents('certs/client.key'); // Or from environment variables $certContent = getenv('GIGYA_CLIENT_CERT'); $keyContent = getenv('GIGYA_CLIENT_KEY'); // Create request with certificate content $request = new GSRequest( null, null, 'accounts.getAccountInfo', null, true, null ); $request->setAPIDomain('us1.gigya.com'); // Pass certificate content as strings (SDK automatically creates temp files) $request->setClientCertificate( $certContent, // Certificate content as string $keyContent, // Key content as string null // Optional: password if key is encrypted ); $response = $request->send();
Note: Both certificate and key must be provided together for mTLS authentication. They can be either:
- File paths (strings):
'certs/client.pem' - PEM content (strings): Raw certificate/key data starting with
-----BEGIN
The SDK automatically detects whether you're passing a file path or PEM content and handles it accordingly.
Running tests
- Copy
tests/provideAuthDetails.json.disttotests/provideAuthDetails.json - If testing JWT-related functions, create a private key file.
- Enter the relevant authentication details and the private key file path in
tests/provideAuthDetails.json.
Limitations
None
Known Issues
None
How to obtain support
Contributing
Via pull request to this repository.
Code of Conduct
See CODE_OF_CONDUCT
To-Do (upcoming changes)
None
Licensing
Please see our LICENSE for copyright and license information.