承接 deegitalbe/laravel-trustup-io-sign 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

deegitalbe/laravel-trustup-io-sign

Composer 安装命令:

composer require deegitalbe/laravel-trustup-io-sign

包简介

Sign url builder.

README 文档

README

Compatibility

Laravel Package
8.x / 9.x 1.x
12.x 2.x

Prerequisite

This package uses deegitalbe/server-authorization package to authenticate requests. Refer to its documentation to make sure it's correctly configured on your project.

Installation

composer require deegitalbe/laravel-trustup-io-sign

Publish configuration

php artisan vendor:publish --provider="Deegitalbe\TrustupIoSign\Providers\TrustupIoSignServiceProvider" --tag="config"

🛠️ config.

Provide all model where you need your relations.

    "models" => [
        YourModel::class,
    ]

Usage

    /** getTrustupIoSignUrl(?string $callback = null, ?string $webhook = null): string */
    $yourmodel->getTrustupIoSignUrl();

🛠️ Default installation BelongsTo relation.

All necessary methods are already defined. Default model type identifier is set to uuid.

<?php

namespace App\Models;

use Deegitalbe\TrustupIoSign\Contracts\Models\BelongsToTrustupIoSignedDocumentRelatedModelContract;
use Deegitalbe\TrustupIoSign\Models\DefaultTrustupIoSignedDocumentRelatedModel;

class Ticket implements BelongsToTrustupIoSignedDocumentRelatedModelContract
{
    use BelongsToTrustupIoSignedDocumentRelatedModel;

    public function getTrustupIoSignOriginalPdfUrl(): string
    {
        return 'https://eforms.com/download/2019/08/Service-Contract-Template.pdf';
    }

    public function getTrustupIoSignCallbackUrl(): string
    {
        return 'https://www.google.com';
    }
}

🛠️ Default installation HasMany relation.

All necessary methods are already defined. Default model type identifier is set to uuid.

<?php

namespace App\Models;

use Deegitalbe\TrustupIoSign\Contracts\Models\HasManyTrustupIoSignedDocumentRelatedModelContract;
use Deegitalbe\TrustupIoSign\Models\HasManyTrustupIoSignedDocumentRelatedModel;

class Ticket implements HasManyTrustupIoSignedDocumentRelatedModelContract
{
    use HasManyTrustupIoSignedDocumentRelatedModel;

    protected $casts = [
        "trustup_io_signed_document_uuids" => 'collection'

    ];

    public function getTrustupIoSignOriginalPdfUrl(): string
    {
        return 'https://eforms.com/download/2019/08/Service-Contract-Template.pdf';
    }

    public function getTrustupIoSignCallbackUrl(): string
    {
        return 'https://www.google.com';
    }
}

🛠️ Common trait.

Both belongsTo and HasMany traits implements IsTrustupIoSignedDocumentRelatedModel. Feel free to overide it for your use case.

<?php

namespace Deegitalbe\TrustupIoSign\Models;

use Illuminate\Support\Str;
use Deegitalbe\TrustupIoSign\Services\SignUrlService;
use Deegitalbe\TrustupIoSign\Facades\TrustupIoSignFacade;

trait IsTrustupIoSignedDocumentRelatedModel
{

    protected string $trustupIoSignCallback;
    protected string $trustupIoSignWebhook;

    /**
     * Getting model identifier
     */
    public function getTrustupIoSignModelId(): string
    {
        /** @var Model $this */
        return $this->uuid ??
            $this->id;
    }

    /**
     * Getting model type for media.trustup.io
     */
    public function getTrustupIoSignModelType(): string
    {
        /** @var Model $this */
        return Str::slug(str_replace('\\', '-', $this->getMorphClass()));
    }


    public function getTrustupIoSignAppKey(): string
    {
        return TrustupIoSignFacade::getConfig("app_key");
    }

    public function getTrustupIoSignWebHookUrl(): string
    {
        // use this adress for locale container 'trustup-io-ticketing/webhooks/trustup-io-sign/signed-document/stored'.
        return route("webhooks.trustup-io-sign.signed-document.stored");
    }

    public function getTrustupIoSignUrl(?string $callback = null, ?string $webhook = null): string
    {
        /** @var SignUrlService */
        $signUrlService = app()->make(SignUrlService::class);
        if ($callback) $this->setTrustupIoSignCallback($callback);
        if ($webhook) $this->setTrustupIoSignWebhook($webhook);

        return $signUrlService->generateUrl($this);
    }

    protected function setTrustupIoSignCallback(string $callback): self
    {
        $this->trustupIoSignCallback = $callback;
        return $this;
    }

    protected function setTrustupIoSignWebhook($webhook): self
    {
        $this->trustupIoSignWebhook = $webhook;
        return $this;
    }
}

⚡⚡ Migration BelongsTo trait.

By default the column is set to trustup_io_signed_document_uuid and type string but feel free to overide it.

<?php

namespace Deegitalbe\TrustupIoSign\Services\Traits;

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

trait BelongsToTrustupioSignedDocumentRelatedMigrations
{
    public function addSignedDocumentColumn(string $model, string  $column = 'trustup_io_signed_document_uuid'): void
    {
        Schema::table($model, function (Blueprint $table) use ($column) {
            $table->string($column)->nullable();
        });
    }

    public function removeSignedDocumentColumn(string $table, string  $column = 'trustup_io_signed_document_uuid'): void
    {
        Schema::table($table, function (Blueprint $table) use ($column) {
            $table->dropColumn($column);
        });
    }
}

⚡⚡ Migration HasMany trait.

By default the column is set to trustup_io_signed_document_uuids and type json but feel free to overide it. Note: Remember to cast as collection in your model !!!

<?php

namespace Deegitalbe\TrustupIoSign\Services\Traits;

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;

trait HasManyTrustupioSignedDocumentRelatedMigrations
{
    public function addSignedDocumentColumn(string $model, string  $column = 'trustup_io_signed_document_uuids'): void
    {
        Schema::table($model, function (Blueprint $table) use ($column) {
            $table->json($column)->nullable();
        });
    }

    public function removeSignedDocumentColumn(string $table, string  $column = 'trustup_io_signed_document_uuids'): void
    {
        Schema::table($table, function (Blueprint $table) use ($column) {
            $table->dropColumn($column);
        });
    }
}

Webhook data structure

{
 "id": 43,
  "uuid": "6dcc41ca-b3b3-4027-9a52-190c249f0606",
  "ip": "192.168.240.8",
  "timezone": null,
  "latitude": null,
  "longitude": null,
  "modelId": "44b1f149-5dd8-494c-a7ec-52edeb666c18",
  "modelType": "ticket",
  "appKey": "trustup-io-ticketing",
  "documentUuid": "e0f26d6a-206f-4ed1-b244-e41e7a4f33f1",
  "signedAt": "2023-03-16T16:35:17.000000Z",
  "document": {
    "app_key": "trustup-io-sign",
    "collection": "files",
    "conversions": [],
    "custom_properties": {
      "width": null,
      "height": null
    },
    "id": 349,
    "model_id": "6dcc41ca-b3b3-4027-9a52-190c249f0606",
    "model_type": "signeddocument",
    "uuid": "e0f26d6a-206f-4ed1-b244-e41e7a4f33f1",
    "url": "https://media.trustup.io.test/storage/e0f26d6a-206f-4ed1-b244-e41e7a4f33f1/lGlUXJYi.pdf",
    "optimized": {
      "url": "https://media.trustup.io.test/storage/e0f26d6a-206f-4ed1-b244-e41e7a4f33f1/lGlUXJYi.pdf",
      "name": "original",
      "width": null,
      "height": null
    },
    "width": null,
    "height": null,
    "name": "lGlUXJYi.pdf"
  }
}

deegitalbe/laravel-trustup-io-sign 适用场景与选型建议

deegitalbe/laravel-trustup-io-sign 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1.81k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 02 月 22 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 deegitalbe/laravel-trustup-io-sign 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 deegitalbe/laravel-trustup-io-sign 我们能提供哪些服务?
定制开发 / 二次开发

基于 deegitalbe/laravel-trustup-io-sign 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-02-22