PHP code example of chrisjohnson00 / api-profiler-bundle

1. Go to this page and download the library: Download chrisjohnson00/api-profiler-bundle 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/ */

    

chrisjohnson00 / api-profiler-bundle example snippets


// app/AppKernel.php

    // ...
    public function registerBundles()
    {
        $bundles = array(
            // ...
            new ChrisJohnson00\ApiProfilerBundle\ChrisJohnson00ApiProfilerBundle(),
        );
    }

$theService->attachData($theURL,
                        $theRequestMethod,
                        $theRequestHeadersAsAnAssociativeArray,
                        $theRequestBody,
                        $theResponseTimeInMilliseconds,
                        $theResponseHeadersAsAnAssociativeArray,
                        $theHTTPStatusCode,
                        $theResponseBody);

public function attachData( $url,
                            $method,
                            $requestHeaders = array(),
                            $requestBody = null,
                            $time,
                            $responseHeaders = array(),
                            $statusCode,
                            $responseBody = null)

$theService->attachData("http://localhost/api/status",
                        "GET",
                        array('User-Agent'=>'My fancy application'),
                        null,
                        125,
                        array('Date'=>'Mon, 07 Oct 2013 00:50:46 GMT','Server'=>'Apache'),
                        200,
                        "Everything is groovy!!");