PHP code example of craigpotter / fca-php-sdk

1. Go to this page and download the library: Download craigpotter/fca-php-sdk 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/ */

    

craigpotter / fca-php-sdk example snippets


use CraigPotter\Fca\Fca;

// Create a new FCA instance (This is  the FCA firm reference number

$firmFrnExists = $fca->firm(12345)->exists(); // Returns a boolean

use CraigPotter\Fca\Fca;

// Create a new FCA instance (This is  the FCA firm reference number

$response = $fca->firm(12345)->get(); // Returns a Saloon response object

$firm = $response->dto(); // Returns a Firm DTO
$firm->frn; // 12345
$firm->name; // "My Firm"
$firm->status; // "Active"
$firm->statusDate; // "2021-01-01"
$firm->statusReason; // "Active"
$firm->companiesHouseNumber; // "12345678"

$json = $response->json(); // Returns the raw JSON response

use CraigPotter\Fca\Fca;

// Create a new FCA instance (This is  the FCA firm reference number

$paginatedData = $fca->firm(12345)->individuals(); // Returns a Saloon response object

$paginatedData->totalPages(); // Returns the total number of pages
$paginatedData->totalResults(); // Returns the total number of results
foreach ($paginatedData as $page) {
    $paginatedData->getCurrentPage(); // Returns the current page number
    $individuals = $page->dto(); // Returns an array of Individual DTOs for this page
    $json = $page->json(); // Returns the raw JSON response for this page
    
    
    foreach ($individuals as $individual) {
        $individual->irn; // "JOHNSMITH12345"
        $individual->name; // "John Smith"
        $individual->status; // "Approved by regulator"
    }
}

use CraigPotter\Fca\Fca;

// Create a new FCA instance (This is  the FCA firm reference number

$paginatedData = $fa->firm(12345)->addresses(); // Returns a Saloon response object

$paginatedData->totalPages(); // Returns the total number of pages
$paginatedData->totalResults(); // Returns the total number of results
foreach ($paginatedData as $page) {
    $paginatedData->getCurrentPage(); // Returns the current page number
    $addresses = $page->dto(); // Returns an array of Address DTOs for this page
    $json = $page->json(); // Returns the raw JSON response for this page
    
    
    foreach ($addresses as $address) {
        $address->website; // "www.example.org"
        $address->phoneNumber; // "44123456778"
        $address->type; // "Principal Place of Business"
        $address->contactName; // "John Smith"
        $address->addressLine1; // "1 Example Street"
        $address->addressLine2; // "Aberdeen"
        $address->addressLine3; // "Aberdeen"
        $address->addressLine4; // "Aberdeen"
        $address->town; // "Aberdeen"
        $address->county; // "Aberdeenshire"
        $address->country; // "United Kingdom"
        $address->postcode; // "AB1 2CD"
    }
}
bash
composer