dunglas/digital-ocean-bundle
Composer 安装命令:
composer require dunglas/digital-ocean-bundle
包简介
DigitalOcean API v2 client for Symfony and API Platform
README 文档
README
DunglasDigitalOceanBundle allows using the DigitalOcean API from your Symfony and API Platform projects. It registers the DigitalOcean PHP API Client as a Symfony service.
If you aren't yet a DigitalOcean user, use this affiliate link to get $100 in free credit!
If you want to deploy your Symfony apps to DigitalOcean, checkout this tutorial.
Example
// src/Controller/DigitalOceanController.php namespace App\Controller; use DigitalOceanV2\Client; use DigitalOceanV2\ResultPager; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class ProductController { #[Route("/droplets")] public function listDroplets(Client $doClient): Response { // get the first 100 droplets as an array $droplets = $doClient->droplet()->getAll(); // or create a new result pager $pager = new ResultPager($doClient); // and get all droplets as an array $droplets = $pager->fetchAll($doClient->droplet(), 'getAll'); // ... } }
Of course, you can also inject the client service into your commands, messenger handlers and any other service.
Installation
Make sure Composer is installed globally, as explained in the installation chapter of the Composer documentation.
Applications that use Symfony Flex
Open a command console, enter your project directory and execute:
composer require dunglas/digital-ocean-bundle symfony/http-client nyholm/psr7 guzzlehttp/promises
The previous command installs the bundle, Symfony HttpClient and the dependencies it needs
to "provide" psr/http-client-implementation and psr/http-factory-implementation.
Alternatively, you can use any other implementation of these interfaces such as Guzzle.
Applications that don't use Symfony Flex
Step 1: Download the Bundle
Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:
$ composer require dunglas/digital-ocean-bundle symfony/http-client nyholm/psr7 guzzlehttp/promises
Step 2: Enable the Bundle
Then, enable the bundle by adding it to the list of registered bundles
in the config/bundles.php file of your project:
// config/bundles.php return [ // ... \Dunglas\DigitalOceanBundle\DunglasDigitalOceanBundle::class => ['all' => true], ];
Configuration
dunglas_digital_ocean: connections: primary: # can be any name token: <your-access-token> secondary: token: <your-access-token> default_connection: primary # If not set, the first in the list will be used
This configuration automatically registers the following autowiring aliases:
DigitalOceanV2\Client $primaryClient
DigitalOceanV2\Client $secondaryClient
If you have only one client, you can use this shortcut:
dunglas_digital_ocean: <your-access-token>
Use the DigitalOceanV2\Client type to inject the default DigitalOcean client.
Credits
This bundle is brought to you by Kévin Dunglas. It is sponsored by Les-Tilleuls.coop.
dunglas/digital-ocean-bundle 适用场景与选型建议
dunglas/digital-ocean-bundle 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.51k 次下载、GitHub Stars 达 31, 最近一次更新时间为 2021 年 08 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「symfony」 「api」 「vps」 「digitalocean」 「Cloud Hosting」 「SSD」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 dunglas/digital-ocean-bundle 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 dunglas/digital-ocean-bundle 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 dunglas/digital-ocean-bundle 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
The bundle for easy using json-rpc api on your project
Azure Virtual Machines REST API PHP library
A PSR-7 compatible library for making CRUD API endpoints
VPS hosting module for the MyAdmin multi-service billing and management platform. Provides VPS provisioning, lifecycle management (start/stop/restart/backup/terminate), slice-based resource scaling, and a full SOAP/REST API for automated ordering and administration.
Bundle Symfony DaplosBundle
DigitalOcean API PHP 5.3+ library for Laravel 4
统计信息
- 总下载量: 2.51k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 31
- 点击次数: 36
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-08-31