https://github.com/trustedshops-public/cot-php-integration-library
A PHP integration library for connecting to Community of Trust platform.
https://github.com/trustedshops-public/cot-php-integration-library
integration trustedshops tslibraries
Last synced: about 1 year ago
JSON representation
A PHP integration library for connecting to Community of Trust platform.
- Host: GitHub
- URL: https://github.com/trustedshops-public/cot-php-integration-library
- Owner: trustedshops-public
- License: mit
- Created: 2024-07-03T12:56:58.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-09T19:59:32.000Z (about 1 year ago)
- Last Synced: 2025-04-09T20:43:55.553Z (about 1 year ago)
- Topics: integration, trustedshops, tslibraries
- Language: PHP
- Homepage:
- Size: 115 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# Community of Trust PHP Integration Library

[](https://dl.circleci.com/status-badge/redirect/gh/trustedshops-public/cot-php-integration-library/tree/main)
This library provides a comprehensive PHP interface for integrating with the Community of Trust (COT) platform, facilitating seamless interactions with its services.
## Requirements
- PHP >= 7.4
- Composer for managing dependencies
## Installation
To install the library, run the following command in your project directory:
```sh
composer require trstd/cot-integration-library
```
## Usage
Here is a basic example of how to use the library:
On the backend side:
```php
, // Trusted Shops ID - e.g. 'X1234567890123456789012345678901'
, // Client ID - e.g. 'cot-switch-X1234567890123456789012345678901'
, // Client Secret - e.g. '1234567890123456789012345678901234567890123456789012345678901234'
, // It can be any storage option implementing AuthStorageInterface - e.g. new DatabaseAuthStorage()
// Environment (optional) - dev, qa, or prod, defaults to prod
);
// Invoke handleCallback function to handle code coming from the authentication server
$client->handleCallback();
// Get anonymous consumer data for the current user
$client->getAnonymousConsumerData();
```
On the frontend side, place the following code in your HTML file where you want the widget to appear:
```html
```
For more detailed examples, please refer to the [`examples/`](./examples/) directory.
## Contributing
Contributions are welcome! Please refer to the [CONTRIBUTING.md](CONTRIBUTING.md) file for guidelines.
## License
This library is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Acknowledgments
- [firebase/php-jwt](https://github.com/firebase/php-jwt) for JWT handling
- [phpseclib/phpseclib](https://github.com/phpseclib/phpseclib) for security features
- [monolog/monolog](https://github.com/Seldaek/monolog) for logging
- [phpfastcache/phpfastcache](https://github.com/PHPSocialNetwork/phpfastcache) for caching solutions
- [symfony/http-client](https://github.com/symfony/http-client) for HTTP client features
## Versioning
This project adheres to [Semantic Versioning](https://semver.org/). For the versions available, see the [tags on this repository](
https://github.com/trustedshops-public/cot-php-integration-library/tags
).
## PHP Package Repository
This library is available on [Packagist](https://packagist.org/packages/trstd/cot-integration-library).