ywh/cvss-bundle

CVSS integration in Symfony2

Installs: 14 581

Dependents: 0

Suggesters: 0

Security: 0

Stars: 2

Watchers: 2

Forks: 2

Open Issues: 0

Type:symfony-bundle

2.0 2022-11-16 09:25 UTC

This package is not auto-updated.

Last update: 2024-04-17 16:09:06 UTC


README

Latest Stable Version Total Downloads Latest Unstable Version License

This bundle provides integration for CVSS in your Symfony2 Project.

License: MIT

Installation

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 ywh/cvss-bundle

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

2: Enable the Bundle

When using Flex, this step is handled automatically.

Then, enable the bundle by adding the following line in the app/AppKernel.php file of your project:

    // app/AppKernel.php

    class AppKernel extends Kernel
    {
        public function registerBundles()
        {
            $bundles = array(
                // ...

                new YWH\CvssBundle\YWHCvssBundle(),
            );

            // ...
        }

        // ...
    }

3: Configure the bundle

# app/config/config.yml
ywh_cvss:
    translation_domain: 'cvss'

Cvss form type

Basic exemple

use YWH\CvssBundle\Form\Type\Cvss3Type;
//...
$builder->add('cvss', Cvss3Type::class);

Advanced exemple

use YWH\CvssBundle\Form\Type\Cvss3Type;
//...
$builder->add('cvss', Cvss3Type::class, array(
    'options' => array(),
    'base_options' => array(
        'required' => true,
    ),
    'temporal' => true,
    'temporal_options' => array(
        'required' => false,
    ),
    'environmental' => true,
    'environmental_options' => array(
        'required' => false,
    ),
));

Cvss3 validator

use YWH\CvssBundle\Validator\Constraints as CvssAssert;

class MyEntity 
{
    //...
    
    /**
     * ...
     * @CvssAssert\Cvss3
     */
    private $cvss;
    
    //...
}