PHP code example of stanislav-web / sonar

1. Go to this page and download the library: Download stanislav-web/sonar library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

stanislav-web / sonar example snippets


"    "stanislav-web/sonar": "dev-master",
}


    // CLI task's configuration ( task configuration
        'sonar' =>  [
            'debug'     =>   true,  // verbose mode
            'errors'    =>   true,  // add errors to logfile
            'cache'     =>   true,  // enable cache
            'errorLog'  =>   APP_PATH.'/../logs/sonar-error.log',

            // queue client configurations
            'beanstalk'        =>  [
                'host'  =>  '127.0.0.1',
                'port'  =>  11300,
            ],

            // webscoket server configuration
            'socket'        =>  [
                'host'  =>  '127.0.0.1',
                'port'  =>  9003,
            ],

            // db storage configuration (Mongo)
            'storage'       =>  [
                'host'      =>  '127.0.0.1',
                'port'      =>  27017,
                'user'      =>  'root',
                'password'  =>  'root',
                'dbname'    =>  'sonar',
            ]
        ]
    ];


    $loader = new \Phalcon\Loader();
    $loader->registerDirs([
        ...
        DOCUMENT_ROOT.'vendor/stanislav-web/sonar/src/Sonar/System/Tasks'
        ...
    ]);

// Create mongo user
mongo

use sonar_test

db.createUser({
        user: "test_user",
        pwd: "test_password",
        roles: [ { role: "userAdmin", db: "sonar_test" } ]
    }
)


phpunit --configuration phpunit.xml.dist --coverage-text

or from your project root: 

phpunit --configuration ./vendor/stanislav-web/sonar/phpunit.xml.dist --coverage-text
python
php composer.phar update
php composer.phar install

php public/cli.php sonar