PHP code example of matthiasmullie / ci-sniffer

1. Go to this page and download the library: Download matthiasmullie/ci-sniffer 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/ */

    

matthiasmullie / ci-sniffer example snippets


$factory = new \MatthiasMullie\CI\Factory();
$provider = $factory->getCurrent();

// outputs 'travis', 'circle', ..., depending on what CI server the code is run
echo $provider->getProvider(); // e.g. 'travis'

// outputs data about the thing being tested
echo $provider->getRepo(); // e.g. 'https://github.com/matthiasmullie/ci-sniffer.git'
echo $provider->getSlug(); // e.g. 'matthiasmullie/ci-sniffer'
echo $provider->getBranch(); // e.g. 'master' (or '', when testing PR)
echo $provider->getPullRequest(); // e.g. '1' (or '', when not testing PR)
echo $provider->getCommit(); // e.g. '01081a9c908717bf315f992b814a36c7c9ba7e65'
echo $provider->getPreviousCommit(); // e.g. '45da9806d50c98f9c88dc0049303cf039b93a95b'
echo $provider->getAuthor(); // e.g. 'Matthias Mullie'
echo $provider->getAuthorEmail(); // e.g. '[email protected]'
echo $provider->getTimestamp(); // e.g. '2016-02-17T18:36:49+01:00'
echo $provider->getBuild(); // e.g. '62.1'