定制 tousanco/laravel-zaya 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tousanco/laravel-zaya

最新稳定版本:v1.1.24

Composer 安装命令:

composer require tousanco/laravel-zaya

包简介

using this package you can easily implement the zaya.io link shortener in your laravel application.

README 文档

README

Check Imports

using this package you can easily implement the Zaya link shortener in your php application.

Installation

You can install the package via composer:

composer require tousanco/laravel-zaya

Usage

First you need to get your API key from Zaya

then add the api key to your env :

ZAYA_API_KEY=*************your-key*****************

Links

use Tousanco\LaravelZaya\Link;

$listParams = [
    // All options nullable
    
    // search (string)
    'search' => 'search key',
    // by (in:title,alias,url) null for all.
    'by' => 'title',
    // ids comma separated (string)
    'ids' => '1,2,3,4,5',
    /*
     * status (int|in:0,1,2,3,4,5,6)
     * 0 or null for all
     * 1 for active
     * 2 for pending
     * 3 for deactivate
     * 4 for suspended
     * 5 for expired 
     */
    'status' => 1,
    // (int) space-id
    'space' => 1,
    // (int) domain-id
    'domain' => 1,
    // favorites (bool|in:1) null for false
    'favorites' => 1,
    /*
     * sort (string|in:desc,asc,max,min)
     * max for maximum clicks
     * min for minimum clicks
     */
    'sort' => 'desc',
];
$links = Link::all($listParams);

$createOrUpdateParams = [
    // All options nullable
    'alias' => 'string',
    'password' => 'string',
    'space' => 'int',
    'domain' => 'int',
    'disabled' => 'int',
    'public' => 'int',
    'description' => 'string',
    'expiration_url' => 'url',
    'expiration_date' => 'Y-m-d',
    'expiration_time' => 'HH:MM',
    'expiration_clicks' => 'int',
];
$link = Link::create('https://example.com', $createOrUpdateParams);

$linkId = 1;
$link = Link::details($linkId);

$link = Link::update($linkId, $createOrUpdateParams);

Link::delete($linkId);

Space

use Tousanco\LaravelZaya\Space;

$listParams = [
    // All options nullable
    'search' => 'string key',
    // sort (string|in:desc,asc)
    'sort' => 'desc',
];
$spaces = Space::all($listParams);

$params = ['name' => 'sample space', 'color' => '#fff'];
$space = Space::create($params);

$spaceId = 1;
$space = Space::details($spaceId);

$space = Space::update($spaceId, $params);

Space::delete($spaceId);

Domain

use Tousanco\LaravelZaya\Domain;

$listParams = [
    // All options nullable
    'search' => 'string key',
    // sort (string|in:desc,asc)
    'sort' => 'desc',
];
$domains = Domain::all($listParams);

$params = [
    'name' => 'yourdomain.com',
    // index_page and not_found_page nullable.
    'index_page' => 'url',
    'not_found_page' => 'url',
];
$domain = Domain::create($params);

$domainId = 1;
$domain = Domain::details($domainId);

// You cannot update the domain name
$domain = Domain::update($domainId, $params);

Domain::delete($domainId);

Stats

use Tousanco\LaravelZaya\Stats;

$linkId = 1;
// The default value is the current day's
$params = ['from' => 'Y-m-d H:i:s', 'to' => 'Y-m-d H:i:s'];
$total = Stats::total($linkId, $params);

$clicks = Stats::clicks($linkId, $params);

$referrers = Stats::referrers($linkId, $params);

$countries = Stats::countries($linkId, $params);

$languages = Stats::languages($linkId, $params);

$browsers = Stats::browsers($linkId, $params);

$devices = Stats::devices($linkId, $params);

$operatingSystems = Stats::operatingSystems($linkId, $params);

Account

use Tousanco\LaravelZaya\Account;

$accountDetails = Account::details();

Timeout

You can set timeout in two ways:

  • You can set timeout on config file
  • When you call the methods of sending the request
use Tousanco\LaravelZaya\Link;

$timeout = 5;
$linkId = 22;
Link::details($linkId, $timeout);

Documentation

See the documentation for more details.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-21

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固