承接 pdmfc/short-url-package-php-8-support 相关项目开发

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

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

pdmfc/short-url-package-php-8-support

Composer 安装命令:

composer require pdmfc/short-url-package-php-8-support

包简介

Url Shortener

README 文档

README

A Http client to interact with the Short Url api service offered by PDM

Table of contents

Installation

Composer:

  • In your composer.json add the following to the "repositories" section:
{
    "type": "vcs",
    "url": "https://github.com/pdmfc/short-url-package-php-8-support.git"
}
  • Require the package:
composer require pdmfc/short-url-package-php-8-support

Configuration

  • Publish the config file:
php artisan vendor:publish --tag="short_config"
  • Add the following environment variables to your .env file with the necessary values defined for your current application:
SHORT_URL_API_ID=
SHORT_URL_API_TOKEN=  
SHORT_URL_API_BASE_URL=

Api

  • If the request headers are incorrect, the response will be the following:
{
    "message": "Access is not allowed"
}

getUrl(string $shortUrl)

Usage:

use Pdmfc\Shorturl\Client\ShortUrlClient;

$client = new ShortUrlClient();

$response = $client->getUrl('Nc');

Successful response:

{
  "Id": 2,
  "shortUrl": "http://teste.ll/Nc",
  "qr_code": "<?xml version=\"1.0\" encodin..."
}

Unsuccessful response:

{
  "message": "shortUrls Nc not found"
}

createUrl(array $params)

Usage:

use Pdmfc\Shorturl\Client\ShortUrlClient;

$client = new ShortUrlClient();

$response = $client->createUrl([
    'domainUrl' => 's.pdm.pt',
    'originalUrl' => 'www.original-url.com/long',
    'liveTime' => 0,
    'active' => true,
    'shortUrl' => '1C',
]);

Successful response:

{
    "Id": 26,
    "shortUrl": "http://s.pdm.pt/1C",
    "qrCode": "<?xml version=\"1.0\" encoding..."
}

Unsuccessful response:

{
    "message": "Is not possible create a short url"
}

changeUrl(string $shortUrl, array $params)

use Pdmfc\Shorturl\Client\ShortUrlClient;

$client = new ShortUrlClient();


$response = $client->updateUrl('Nc', [
        'originalUrl' => 'www.original-url-changed.com',
]);

Successful response:

{
  "Id": 26,
  "shortUrl": "http://teste.ll/1C",
  "qrCode": "<?xml version=\"1.0\" encoding..."
}

Unsuccessful response:

{
  "message": "Is not possible update the short url"
}

deleteUrl(string $shortUrl)

use Pdmfc\Shorturl\Client\ShortUrlClient;

$client = new ShortUrlClient();

$response = $client->deleteUrl('Nc');

Successful response:

{
  "message": "Code Nc was deleted with success"
}

Unsuccessful responses:

{
  "message": "Is not possible delete a short url"
}
{
  "message": "shortUrls Nc not found"
}
Params:
Param Type Required Default Description Example
domainUrl string Short url domain http://teste.com
originalUrl string ✔️ Url where you will be redirected www.original-url.com/long
liveTime integer 0 expiration time 60
active boolean true Define if the link is active false
shortUrl string Uri to be generated. If none provided, it will automatically generated a12

Tests

To run the test suite, first you must copy the phpunit.xml.dist:

cp phpunit.xml.dist phpunit.xml

Make sure to uncomment the ENV variables on your phpunit configuration file and add the necessary values:

<env name="SHORT_URL_API_BASE_URL" value=""/>
<env name="SHORT_URL_API_ID" value=""/>
<env name="SHORT_URL_API_TOKEN" value=""/>

Now you can run the test suite:

vendor/bin/phpunit

⚠️ Be careful!

Do not add your phpunit config values directly into the phpunit.xml.dist file since this file will be in the version control repository!

pdmfc/short-url-package-php-8-support 适用场景与选型建议

pdmfc/short-url-package-php-8-support 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 5.67k 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 02 月 18 日, 在 PHP 生态内属于活跃度较高的组件。

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

围绕 pdmfc/short-url-package-php-8-support 我们能提供哪些服务?
定制开发 / 二次开发

基于 pdmfc/short-url-package-php-8-support 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

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

GitHub 信息

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

其他信息

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