承接 previewlinks/php-previewlinks 相关项目开发

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

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

previewlinks/php-previewlinks

最新稳定版本:v1.0.0

Composer 安装命令:

composer require previewlinks/php-previewlinks

包简介

The official PHP Previewlinks client

README 文档

README

This is the official PreviewLinks client for PHP.

Installation

You can install the package via composer:

composer require previewlinks/php-previewlinks

Usage

Images

Use the image method to generate downloadable image URLs, be aware that this might increase the loading time on your page. If you want to use this for on-demand previews continue to Async images.

<?php

use PreviewLinks\PreviewLinks;

$previewlinks = new PreviewLinks('<YOUR_SITE_API_KEY>');

$response = $previewlinks->image(
    templateId: 1,
    fields: [
        'previewlinks:title' => 'Hello from PHP SDK',
    ],
);

// `$response` will return the response object
// Be aware that you have to handle any errors or exceptions
$url = $response->toArray(throw: false)['url'];

Async images

Async images are perfect if you don't want to download the image or use meta tags. It'll return a signed URL which you can put inside your OG or Twitter image meta tag.

<?php

use PreviewLinks\PreviewLinks;

$previewlinks = new PreviewLinks('<YOUR_SITE_API_KEY>');

$url = $previewlinks->asyncImage(
    templateId: 1,
    fields: [
        'previewlinks:title' => 'Hello from PHP SDK',
    ],
);

// <meta name="twitter:image" content="{{ $url }}" >

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2022-12-09