sensiolabs/insight
Composer 安装命令:
composer require sensiolabs/insight
包简介
SymfonyInsight SDK
README 文档
README
About
This is the official SDK for the SymfonyInsight API.
Installation
To install the SDK, run the command below and you will get the latest version:
composer require sensiolabs/insight
Command Line Tool
The easiest way to use the SymfonyInsight API is via the built-in command line tool.
A phar version of the command line tool exists to avoid installation of this project. Download it, then use it like the command line tool:
$ curl -o insight.phar -s https://get.insight.symfony.com/insight.phar
# or
$ wget https://get.insight.symfony.com/insight.phar
# Then
$ php insight.phar
List all the projects in your account:
$ php insight.phar projects
The first time, you will be prompted for your SymfonyInsight API key and user UUID (which can be found under the "Account" section on the website).
These information are then stored locally, but can still be overridden via the
--api-token and --user-uuid options.
To run an analysis:
$ php insight.phar analyze UUID
where UUID is the UUID of the project you want to analyze (the UUIDs are
listed by the projects command).
To export an analysis report:
$ php insight.phar analysis UUID --format="xml" # or --format="json" or --format="pmd"
Configuration
use SensioLabs\Insight\Sdk\Api;
$api = new Api(array(
'api_token' => 'your api token',
'user_uuid' => 'your user uuid',
));
Usage
List all projects:
$api->getProjects();
$api->getProjects(2); // For the second page
Get a project:
$project = $api->getProject('project uuid');
Update a project
$api->updateProject($project);
Note: If something went wrong, see Error management section
Post a project
use SensioLabs\Insight\Sdk\Model\Project;
$project = new Project();
$project
->setName('Foo')
->setDescription('Foo')
->setType(TYPE_WEBSITE::TYPE_WEBSITE)
;
$api->createProject($project)
Note: If something went wrong, see Error management section
Run an analysis
// on the default branch
$api->analyze('project uuid', 'master');
// for a specific branch or reference
$api->analyze('project uuid', '1.0');
Get all analyses
$api->getAnalyses('project uuid');
// for a specific branch
$api->getAnalyses('project uuid', 'branch name');
Get an analysis
$api->getAnalysis('project uuid', 'analysis id');
Get a status analysis
$api->getAnalysisStatus('project uuid', 'analysis id');
Error management
If something went wrong, an
SensioLabs\Insight\Sdk\Exception\ExceptionInterface will be throw:
ApiClientExceptionIf you did something wrong. This exception contains the previous exception throw by guzzle. You can easily check if it is a:- 403: In this case, check your credentials
- 404: In this case, check your request
- 400: In this case, check the data sent. In this case, the Exception will
contains a
SensioLabs\Insight\Sdk\Model\Errorobject. Which will contains all form errors.
ApiServerExceptionIf something went wrong with the API.
License
This library is licensed under the MIT license.
sensiolabs/insight 适用场景与选型建议
sensiolabs/insight 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 17.84k 次下载、GitHub Stars 达 81, 最近一次更新时间为 2013 年 07 月 05 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 sensiolabs/insight 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 sensiolabs/insight 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 17.84k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 82
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2013-07-05