cregis / cregis-sdk-php
Cregis API SDK for PHP 7.x/8.x
Installs: 190
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 1
Open Issues: 0
pkg:composer/cregis/cregis-sdk-php
Requires
- php: ^7.0 || ^8.0
- guzzlehttp/guzzle: ^6.5 || ^7.0
- vlucas/phpdotenv: 5.5
This package is not auto-updated.
Last update: 2025-12-05 10:33:36 UTC
README
I. Prerequisites
- PHP version ≥ 7.0
- Composer installed (dependency management tool)
- Project
.envfile configured
II. SDK Installation
Install the SDK to your project via Composer:
composer require cregis/cregis-sdk-php:^2.0
After installation, Composer will automatically handle dependencies and generate vendor/autoload.php, and the framework will automatically load the SDK libraries.
III. Framework Integration Guide
Add the following content to the .env file in the root directory
## production or development environment ENVIRONMENT=production # API base URL (default value can be modified as needed) API_BASE_URI=https://t-xxxxxxx.cregis.io # API key API_KEY=16d4xxxxxxxxxxxxxxxxxxbd7895f4d # Project ID PID=1418xxxxxxxxxxx89664
Add references where needed
use Cregis\Services\PayoutService; use Cregis\Services\DepositService; use Cregis\Services\CallbackService;
Example of creating an address, other examples can be found in demo.php in the SDK
public function createAddress() { $depositService = new DepositService(); try { $result = $depositService->createAddress([ "callback_url"=> "http://xxxx.com/deposit/callback", "chain_id"=> "60", "alias"=> "cc", ]); echo "createAddress: " . json_encode($result, JSON_UNESCAPED_UNICODE) . "\n"; } catch (\Exception $e) { echo "createAddress-error:" . $e->getMessage() . "\n"; } return 'hello,' ; }
IV. Notes
- Ensure that the framework's
vendor/autoload.phpis correctly loaded (already handled by mainstream frameworks by default). - For production environments, set
ENVIRONMENTtoproductionin the.envfile to avoid using test environment interfaces. - If the framework does not automatically load the
.envfile (e.g., ThinkPHP), you need to manually callDotenv\Dotenv::createImmutable(__DIR__)->load();to load the configuration.