All Projects → symfonycorp → Insight

symfonycorp / Insight

Licence: mit
SymfonyInsight Official SDK

Projects that are alternatives of or similar to Insight

Connect
The SymfonyConnect official API SDK
Stars: ✭ 86 (+17.81%)
Mutual labels:  symfony, sdk
Go Unifi
Unifi Controller API SDK for Go
Stars: ✭ 71 (-2.74%)
Mutual labels:  sdk
Directus Docker
Directus 6 Docker — Legacy Container [EOL]
Stars: ✭ 68 (-6.85%)
Mutual labels:  sdk
In App Payments React Native Plugin
Stars: ✭ 70 (-4.11%)
Mutual labels:  sdk
Security Guard
The Guard component brings many layers of authentication together, making it much easier to create complex authentication systems where you have total control.
Stars: ✭ 1,157 (+1484.93%)
Mutual labels:  symfony
Pd Admin
Powerful Admin Dashboard for Symfony 5
Stars: ✭ 70 (-4.11%)
Mutual labels:  symfony
Scanbot Sdk Example Android
Document scanning SDK example apps for the Scanbot SDK for Android.
Stars: ✭ 67 (-8.22%)
Mutual labels:  sdk
Foal
Elegant and all-inclusive Node.Js web framework based on TypeScript. 🚀.
Stars: ✭ 1,176 (+1510.96%)
Mutual labels:  sdk
Ghost
move to https://github.com/cshome/cshome
Stars: ✭ 70 (-4.11%)
Mutual labels:  symfony
Android P2p Engine
Let your viewers become your unlimitedly scalable CDN.
Stars: ✭ 70 (-4.11%)
Mutual labels:  sdk
Countly Sdk Cordova
Countly Product Analytics SDK for Cordova, Icenium and Phonegap
Stars: ✭ 69 (-5.48%)
Mutual labels:  sdk
Libra Grpc
A lightweight JavaScript library for Libra
Stars: ✭ 69 (-5.48%)
Mutual labels:  sdk
Laravel Storage Qiniu
Laravel 5 七牛存储组件(不再维护)
Stars: ✭ 70 (-4.11%)
Mutual labels:  sdk
Seriouscode
This header file enforces Clang warnings to bu turned-on for specific flags (almost everyone, at least each one I was able to find).
Stars: ✭ 68 (-6.85%)
Mutual labels:  quality
Aliyun Openapi Java Sdk
Alibaba Cloud SDK for Java
Stars: ✭ 1,170 (+1502.74%)
Mutual labels:  sdk
Ansible Provisioning Tywin
Generate your Ansible provisioning for Symfony2, Laravel and Node.js projects
Stars: ✭ 67 (-8.22%)
Mutual labels:  symfony
Line Bot Sdk Perl
LINE Messaging API SDK for Perl
Stars: ✭ 69 (-5.48%)
Mutual labels:  sdk
Dart algolia
[Unofficial] Algolia is a pure dart SDK, wrapped around Algolia REST API for easy implementation for your Flutter or Dart projects.
Stars: ✭ 70 (-4.11%)
Mutual labels:  sdk
Cronos Bundle
Easy update your crontab by using @cron annotations in Symfony commands.
Stars: ✭ 73 (+0%)
Mutual labels:  symfony
Russianpost
SDK для работы с API Почты России (pochta.ru)
Stars: ✭ 72 (-1.37%)
Mutual labels:  sdk

SymfonyInsight SDK

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 http://get.insight.sensiolabs.com/insight.phar
# or
$ wget http://get.insight.sensiolabs.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');

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:

  • ApiClientException If 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\Error object. Which will contains all form errors.
  • ApiServerException If something went wrong with the API.

Jenkins/Hudson Integration

Thanks to Jenkins PMD Plugin and SymfonyInsight SDK PMD output you can easily embed SymfonyInsight reports into your build workflow, following these steps:

It is assumed you already have your project up and building in Jenkins and SymfonyInsight SDK installed.

  1. Retrieve your SymfonyInsight API Token, User UUID and Project UUID on your account page

  2. Install the Jenkins PMD plugin: How to install a jenkins plugin

  3. Optionally you can also install the EnvInject Plugin

  4. Edit your project configuration

  5. If you have EnvInject Plugin installed, enabled Set environment variables then add and adapt the following lines to variables name:

     INSIGHT_API_TOKEN="Your API Token"
     INSIGHT_USER_UUID="Your user UUID"
     INSIGHT_PROJECT_UUID="Your project UUID"
    
  6. Add a Execute shell build step

  7. In the new shell step add and adapt the following command (if you don't have EnvInject plugin, replace variables by plain values):

     /path/to/insight-sdk/bin/insight analysis \
     --user-uuid $INSIGHT_USER_UUID \
     --api-token $INSIGHT_API_TOKEN \
     $INSIGHT_PROJECT_UUID --format=pmd > insight-pmd.xml
    
  8. Enable Publish PMD analysis results using insight-pmd.xml as PMD result filename

  9. Optionally, you can add the insight-pmd.xml file to artifacts to archive

  10. Save and build!

License

This library is licensed under the MIT license.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].