tectly/client 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tectly/client

最新稳定版本:v1.2.4

Composer 安装命令:

composer require tectly/client

包简介

PHP SDK for Tectly Floorplan Recognition API

README 文档

README

Tectly PHP Client

Tectly is an AI-powered floor-plan recognition service that can ingest virtually any floor plan format (scans, JPGs, PDFs, CAD files, or hand sketches) and automatically extract structural elements like walls, rooms, doors, windows, and measurements. It lets you edit the generated geometry in a browser, and offers export of structured building data (JSON, CSV, Excel) as well as integration via a REST API, SDKs, or embeddable web widget.

The Tectly PHP Client is a the PHP binding of the Tectly Rest API with some convenience functions for easy use.

Installation & Usage

Composer

Install the bindings via Composer using composer require tectly/client. This package requires PHP 8.1 or later.

Getting Started

The simplest way to get started is to use the TectlyClient. It authenticates with the given credentials and let's you follow the individual entities as they are processed.

use Tectly\OpenAPI\Model\ProcessingStatus;
use Tectly\OpenAPI\Model\ProjectCreate;
use Tectly\OpenAPI\TectlyClient;

$client = new TectlyClient(getenv('TECTLY_API_KEY'), getenv('TECTLY_API_SECRET'));
$documentFile = new SplFileObject(getenv('TECTLY_TEST_FILE'));

$project = $client->projectsApi->createProject(new ProjectCreate(['title' => 'My project']));
$document = $client->documentsApi->addDocument($project->getId(), $documentFile);

// Optionally:
// $db->persist($document->getId());
// $documentId = $db->getDocumentId();

$document = $client->awaitDocument($document->getId());
if ($document->getPageRenderingStatus() !== ProcessingStatus::POSITIVE) {
    $documentId = $document->getId();
    throw new \RuntimeException("Document $documentId is failed to render.");
}

$floors = [];

foreach ($document->getDocumentPages() as $page) {
    $page = $client->awaitDocumentPage($page->getId());
    if ($page->getPlanDetectionStatus() !== ProcessingStatus::POSITIVE) {
        continue; // Ignore pages without plans.
    }

    foreach ($page->getPlans() as $plan) {
        // Use progress as desired.
        // $plan->getHorizontalScaleProcessingStatus();
        // $plan->getWallProcessingStatus();
        // $plan->getRoomProcessingStatus();
        // $plan->getWallOpeningProcessingStatus();
        // $plan->getPostProcessingStatus();

        // Or wait for the plan to be processed.
        $plan = $client->awaitPlan($plan->getId());

        $floor =  $client->floorsApi->fetchFloor($plan->getFloorId());
        $floors[] = $floor;
    }
}

foreach ($floors as $floor) {
    $elements = $client->fetchFloorElements($floor->getId());
    // Do something with $elements['rooms'], $elements['walls'], $elements['wallOpenings']]
}

Documentation

Please find detailed documentations in the following places:

  1. PHP Client Documentation
  2. API Endpoints Documentation
  3. Data Model Documentation

Further Links

统计信息

  • 总下载量: 40
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-15