craigpotter/fca-php-sdk
Composer 安装命令:
composer require craigpotter/fca-php-sdk
包简介
An unofficial PHP SDK consuming the FCA API
README 文档
README
This is an unofficial PHP SDK for FCA's API and is powered by Saloon.
Note: This SDK is still in development and is not yet ready for production use. Use at your own risk.
Installation
You can install the package via composer:
composer require craigpotter/fca-php-sdk
Requirements
You will need to have a valid API key from FCA to use this SDK.
You can obtain one by registering as a developer.
Example Usage
use CraigPotter\Fca\Fca; // Create a new FCA instance (This is required for all requests) $fca = new Fca('my.email@dev.test', 'my-api-key'); // 12345 is the FCA firm reference number $firmFrnExists = $fca->firm(12345)->exists(); // Returns a boolean $response = $fca->firm(12345)->get(); $firm = $response->dto(); // Returns a Firm DTO $json = $response->json(); // Returns the raw JSON response
Documentation
Warning: This documentation is still a work in progress.
Some responses have the option of a DTO (Data Transfer Object) which can be used to access the response data.
This does not work for all responses, but is documented where it is available.
For all other responses, you can access the raw JSON response using $response->json().
Firms
Check an FRN exists
use CraigPotter\Fca\Fca; // Create a new FCA instance (This is required for all requests) $fca = new Fca('my.email@dev.test', 'my-api-key'); // 12345 is the FCA firm reference number $firmFrnExists = $fca->firm(12345)->exists(); // Returns a boolean
Get a firm by FRN
use CraigPotter\Fca\Fca; // Create a new FCA instance (This is required for all requests) $fca = new Fca('my.email@dev.test', 'my-api-key'); // 12345 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
Get the individuals associated with a firm by FRN
This endpoint is paginated and will return a maximum of 20 results per page.
You should loop through the pages to get all results.
use CraigPotter\Fca\Fca; // Create a new FCA instance (This is required for all requests) use CraigPotter\Fca\Fca; // Create a new FCA instance (This is required for all requests) $fca = new Fca('my.email@dev.test', 'my-api-key'); // 12345 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" } }
Get the addresses associated with a firm by FRN
This endpoint is paginated and will return a maximum of 20 results per page.
You should loop through the pages to get all results.
use CraigPotter\Fca\Fca; // Create a new FCA instance (This is required for all requests) use CraigPotter\Fca\Fca; // Create a new FCA instance (This is required for all requests) $fca = new Fca('my.email@dev.test', 'my-api-key'); // 12345 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" } }
Testing
Copy .env.example to .env and update accordingly.
vendor/bin/pest
Credits
License
The MIT License (MIT). Please see License File for more information.
craigpotter/fca-php-sdk 适用场景与选型建议
craigpotter/fca-php-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 67.28k 次下载、GitHub Stars 达 2, 最近一次更新时间为 2023 年 06 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 craigpotter/fca-php-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 craigpotter/fca-php-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 67.28k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-06-14