1. Go to this page and download the library: Download sejongtf/laravel-fsc 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/ */
sejongtf / laravel-fsc example snippets
use Sejongtf\Fsc\Facades\Fsc;
$response = Fsc::get(
'service/GetStockSecuritiesInfoService', // servicePath
'getStockPriceInfo', // operation
['likeItmsNm' => '삼성', 'numOfRows' => 20],
);
$response->items(); // array<int, array> — 결과 목록 (단건도 배열로 정규화)
$response->totalCount(); // int
$response->pageNo(); // int
$response->hasMorePages(); // bool
$response->raw(); // 원본 응답 배열
use Sejongtf\Fsc\Http\Client;
public function __construct(private Client $client) {}
// FSC_CACHE_ENABLED=true 인 경우, 동일 인자의 두 번째 호출은 캐시에서 제공됩니다.
$first = Fsc::corp()->getCorpOutline(crno: '1101113892240'); // 네트워크 호출
$second = Fsc::corp()->getCorpOutline(crno: '1101113892240'); // 캐시 적중
use Sejongtf\Fsc\Facades\Fsc;
// 원시 Response 로 받기
$response = Fsc::corp()->getCorpOutline(crno: '1101113892240');
$response->items(); // array<int, array>
$response->totalCount(); // int
// 법인명으로 부분 검색 + 기준일자 지정
$response = Fsc::corp()->getCorpOutline(
corpNm: '메리츠',
params: ['basDt' => '20240102', 'numOfRows' => 50],
);
// CorpOutline DTO 배열로 받기
$outlines = Fsc::corp()->getCorpOutlineAsObjects(corpNm: '메리츠');
foreach ($outlines as $corp) {
$corp->corpNm; // 법인명
$corp->enpRprFnm; // 대표자명
$corp->bzno; // 사업자등록번호
$corp->employeeCount(); // ?int — 종업원수
$corp->isSmallMediumEnterprise(); // ?bool — 중소기업 여부
}
use Sejongtf\Fsc\Endpoints\Corp\CorpOutline;
$outlines = $response->mapInto(CorpOutline::class);
use Sejongtf\Fsc\Facades\Fsc;
use Sejongtf\Fsc\Endpoints\Proprietor\ProprietorProfile;
// 개인사업자개요정보조회 (getOtlInfo)
$outlines = Fsc::proprietor()->getOutlineAsObjects([
'basYm' => '202208', // 기준년월 (YYYYMM)
'bizAreaNm' => '속초', // 사업 지역명 (부분 검색)
'bizBzcCdNm' => '제조업', // 사업 업종명 (부분 검색)
'bizBzcCd' => '10', // 사업 업종코드
'estbYr' => '2007', // 설립년도
'rprSexNm' => '남성', // 대표자 성별명
'numOfRows' => 50,
]);
foreach ($outlines as $row) {
$row->bizAreaNm; // 사업 지역명 (시군구)
$row->bizBzcCdNm; // 사업 업종명
$row->rprAggrNm; // 대표자 연령대명 (예: 70대)
$row->establishmentYear(); // ?int — 설립년도
}
// 개인사업자휴폐업정보조회 (getCsdoStatus)
$rows = Fsc::proprietor()->getClosureStatusAsObjects(['basYm' => '202208']);
$rows[0]->csdoClsfNm; // 휴폐업구분명 (휴업/폐업/휴폐업)
$rows[0]->isClosed(); // ?bool
// 원시 Response 가 필요하면 getOutline() / getClosureStatus() 사용
$response = Fsc::proprietor()->getOutline(['basYm' => '202208']);
$response->totalCount();