tousanco/laravel-zaya
Composer 安装命令:
composer require tousanco/laravel-zaya
包简介
using this package you can easily implement the zaya.io link shortener in your laravel application.
关键字:
README 文档
README
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.
tousanco/laravel-zaya 适用场景与选型建议
tousanco/laravel-zaya 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 3.46k 次下载、GitHub Stars 达 4, 最近一次更新时间为 2023 年 08 月 21 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「link shortener」 「zaya」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 tousanco/laravel-zaya 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tousanco/laravel-zaya 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 tousanco/laravel-zaya 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A couple of handy form fields and objects for managing external and internal links on DataObjects
PHP library that allows linking queries from diferent physical databases using mysql pdo database connections
Custom links on your sidebar for Laravel Nova.
A Laravel package to shorten urls
Set Links with a specific language parameter
A tool for scraping URL resources (oEmbed, OpenGraph, Twitter cards, JSON-LD)
统计信息
- 总下载量: 3.46k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-21