Skip to content

Latest commit

 

History

History
137 lines (91 loc) · 2.6 KB

README.md

File metadata and controls

137 lines (91 loc) · 2.6 KB

DevSecTools SDK for PHP

Experimental. Untested. Not ready for primetime. Exploring code generation.

Overview

A PHP SDK for interacting with the DevSecTools API.

This client provides an easy way to interact with the DevSecTools API, which scans websites for security-related information such as HTTP version support and TLS configurations.

  • ✅ Requires PHP 8.1+.
  • ✅ Uses Guzzle to handle HTTP requests and supports both synchronous and asynchronous (parallel) requests.
  • ✅ Fully-typed; ensures strong IDE support with proper type hints and PSR-5 docblocks.
  • ✅ PSR-4 autoloading configured.
  • ✅ Supports versions of PHP which receive support from the core team.

Model

Usage

Instantiating with default configuration

<?php
declare(strict_types=1);

require 'vendor/autoload.php';

use DevSecTools\Client;
use DevSecTools\Endpoint;

// Using default configuration
$api = new Client();

Custom configuration

See example…
<?php
declare(strict_types=1);

require 'vendor/autoload.php';

use DevSecTools\Client;
use DevSecTools\Endpoint;

// Using custom configuration
$api = new Client([
  'base_uri'        => Endpoint::LOCALDEV,
  'timeout_seconds' => 10,
]);

Updating configuration at runtime

See example…
<?php
declare(strict_types=1);

require 'vendor/autoload.php';

use DevSecTools\Client;
use DevSecTools\Endpoint;

// Using default configuration
$api = new Client();

// Updating the configuration
$api->setBaseUri(Endpoint::LOCALDEV);
$api->setTimeoutSeconds(15);

Making single requests

See example…
<?php
declare(strict_types=1);

require 'vendor/autoload.php';

use DevSecTools\Client;
use DevSecTools\Endpoint;

// Using default configuration
$api = new Client();

$httpInfo = $api->http('example.com');
print_r($httpInfo);

Making parallel/batch requests

See example…
<?php
declare(strict_types=1);

require 'vendor/autoload.php';

use DevSecTools\Client;
use DevSecTools\Endpoint;

// Using default configuration
$api = new Client();

// Running multiple requests in parallel
$batchResults = $api->batch([
    ['method' => 'http', 'url' => 'apple.com'],
    ['method' => 'tls',  'url' => 'google.com'],
]);

print_r($batchResults);