renoki-co/laravel-steampipe
Composer 安装命令:
composer require renoki-co/laravel-steampipe
包简介
Use Laravel's built-in ORM classes to query cloud resources with Steampipe.
README 文档
README
Use Laravel's built-in ORM classes to query cloud resources with Steampipe, an open source CLI to instantly query cloud APIs using SQL.
🤝 Supporting
If you are using one or more Renoki Co. open-source packages in your production apps, in presentation demos, hobby projects, school projects or so, sponsor our work with Github Sponsors. 📦
🚀 Installation
You can install the package via composer:
composer require renoki-co/laravel-steampipe
In your config/database.php, add a new driver:
'connections' => [ 'steampipe' => [ 'driver' => 'steampipe', 'binary' => env('STEAMPIPE_BINARY', 'steampipe'), ], ],
You can define the Steampipe binary path with STEAMPIPE_BINARY.
🙌 Usage
Steampipe is multi-vendor, multi-plugin. This means that you can interact with any cloud APIs just like yo would do with Postgres.
For it to work locally and avoid code pollution, you would want to create a model for the "tables" you would want to access the cloud APIs through.
For example, let's make a AwsRegion model for the aws_region table. Make sure you have installed the AWS plugin for Steampipe.
php artisan steampipe:make:model aws_region
Please observe that the models are created from the table in singular, aws_region. Usually, in Laravel you would have created the model class name directly. To break even and make the generation command easier, you should pass the table name instead of a class name.
The command will create for you an app/Steampipe/Aws/AwsRegion.php file where you can access the model:
use App\Steampipe\Aws\AwsRegion; foreach (AwsRegion::all() as $region) { // }
All SQL-like methods from Laravel ORM are available to be used as explained in the Steampipe documentation.
Models also work with the built-in model features, like hidden fields or appends.
Generation
You may generate as many models as you need. The convention is that when creating a table, it will always follow this pattern:
App\Steampipe\{Provider}\{TableNameStudlyCase};
This way, the models will know how to access the tables. For example, for a DigitalOcean droplet it would look like this:
php artisan steampipe:make:model digitalocean_droplet
use App\Steampipe\Digitalocean\DigitaloceanDroplet; DigitaloceanDroplet::find(227211874);
🐛 Testing
You will need to set up an AWS account and add AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY to your environment variables.
The user with the access tokens should have the following IAM policy:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "ec2:DescribeRegions",
"Resource": "*"
}
]
}
To run tests:
vendor/bin/phpunit
🤝 Contributing
Please see CONTRIBUTING for details.
🔒 Security
If you discover any security related issues, please email alex@renoki.org instead of using the issue tracker.
🎉 Credits
renoki-co/laravel-steampipe 适用场景与选型建议
renoki-co/laravel-steampipe 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3 次下载、GitHub Stars 达 14, 最近一次更新时间为 2021 年 09 月 17 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「orm」 「php」 「sql」 「query」 「cloud」 「aws」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 renoki-co/laravel-steampipe 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 renoki-co/laravel-steampipe 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 renoki-co/laravel-steampipe 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Kinikit - PHP Application development framework MVC component
PHP Database ORM for Symfony1. Do NOT use for new projects: please move to a newest Symfony release and Doctrine2
Query filtering in your frontend
Database/ORM-agnostic query construction helper
PeskyORM - annoying ORM that contains tons of exceptions and throws them when anything goes wrong
Laravel SQL Queries Dumper
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 14
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Apache-2.0
- 更新时间: 2021-09-17