tourze / digital-ocean-account-bundle
DO接口
Installs: 95
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^8.1
- doctrine/dbal: ^4.0
- doctrine/doctrine-bundle: ^2.13
- doctrine/orm: ^3.0
- doctrine/persistence: ^3.1 || ^4
- psr/log: ^3|^2|^1
- symfony/config: ^6.4
- symfony/dependency-injection: ^6.4
- symfony/framework-bundle: ^6.4
- symfony/http-client-contracts: ^2.5 | ^3.0
- symfony/http-kernel: ^6.4
- symfony/yaml: ^6.4 || ^7.1
- tourze/arrayable: 0.0.*
- tourze/doctrine-indexed-bundle: 0.0.*
- tourze/http-client-bundle: 0.1.*
- tourze/symfony-aop-doctrine-bundle: 0.0.*
Requires (Dev)
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.0
This package is auto-updated.
Last update: 2025-05-14 08:46:45 UTC
README
A Symfony bundle for integrating with DigitalOcean API, providing account management, SSH key management, and configuration services.
Features
- Complete DigitalOcean API v2 integration
- Account information management and synchronization
- SSH key management (create, list, delete)
- Configuration management for DigitalOcean API access
- Doctrine ORM integration for data persistence
- Symfony Bundle integration with autowiring support
Installation
composer require tourze/digital-ocean-account-bundle
Register the bundle in your config/bundles.php
file:
<?php return [ // ... DigitalOceanAccountBundle\DigitalOceanAccountBundle::class => ['all' => true], // ... ];
Quick Start
Configuration
Create a configuration file at config/packages/digital_ocean_account.yaml
:
digital_ocean_account: api_key: '%env(DIGITAL_OCEAN_API_KEY)%'
Set your DigitalOcean API key in your .env
file:
DIGITAL_OCEAN_API_KEY=your_digital_ocean_api_key
Usage Examples
Accessing Account Information
<?php use DigitalOceanAccountBundle\Service\AccountService; class YourController { public function index(AccountService $accountService) { // Get account information from DigitalOcean API $accountData = $accountService->getAccount(); // Synchronize account information to database $account = $accountService->syncAccount(); // Use account data... } }
Managing SSH Keys
<?php use DigitalOceanAccountBundle\Service\SSHKeyService; class YourController { public function manageSshKeys(SSHKeyService $sshKeyService) { // List all SSH keys $keys = $sshKeyService->listKeys(); // Create a new SSH key $newKey = $sshKeyService->createKey('my-key-name', 'ssh-rsa AAAA...'); // Delete an SSH key $sshKeyService->deleteKey($keyId); } }
API Documentation
The bundle provides several services for interacting with the DigitalOcean API:
AccountService
: Account information managementSSHKeyService
: SSH key managementDigitalOceanConfigService
: API configuration managementDigitalOceanClient
: Low-level API client
Each service is automatically registered and can be autowired in your Symfony application.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
The MIT License (MIT). Please see License File for more information.