bitly-api/sdk 问题修复 & 功能扩展

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

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

bitly-api/sdk

最新稳定版本:1.7.0

Composer 安装命令:

composer require bitly-api/sdk

包简介

PHP library for Bitly API.

README 文档

README

packagist build test

PHP library for Bitly. Code is generated using the OpenAPI spec. See the API reference.

Requirements

Version

PHP >=8.0

API Key

Generate an access token.

Install

Install the package with Composer:

composer require bitly-api/sdk

If you're missing a package providing psr/http-client-implementation:

composer require php-http/guzzle7-adapter

Add autoloading:

require_once 'vendor/autoload.php';

Usage

Instantiate the SDK:

use Bitly\Bitly;

$bitly = new Bitly('YOUR_API_KEY');

$client = $bitly->client;

Convert a long URL to a Bitlink:

use Bitly\Bitly;
use Bitly\Model\Shorten;

$bitly = new Bitly('YOUR_API_KEY');

$shorten = new Shorten();
$shorten->setLongUrl('https://example.com/my-long-url');
$response = $bitly->client->createBitLink($shorten);

Handle an API error:

use Bitly\Bitly;

$bitly = new Bitly('YOUR_API_KEY');

try {
    $bitly->client->getBitlink('http://bit.ly/2OUJim0');
} catch (Throwable $exception) {
    echo $exception->getMessage();
    echo $exception->getCode();
}

Scripts

composer build

Generate the code:

composer build

composer clean

Delete the lib/ directory:

composer clean

composer test

Run the tests:

composer test

About This Package

This package is automatically generated by Jane.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-02-26