New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

tousanco/laravel-zaya

using this package you can easily implement the zaya.io link shortener in your laravel application.
3,484 4
Install
composer require tousanco/laravel-zaya
Latest Version:v1.1.24
PHP:>=7.1.3
Laravel:5 – 13
License:MIT
Last Updated:May 6, 2026
Links: GitHub  ·  Packagist
Maintainer: tousanco

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*****************
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.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

648,266,899 9,701
laravel/framework

The Laravel Framework.

604,216,237 34,982
laravel/tinker

Powerful REPL for the Laravel framework.

512,508,631 7,443
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

429,221,767 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

403,217,078 4,664

Version History

Version Released PHP Laravel License
v1.1.24 >=7.1.3 5.*|6.*|7.*|8.*|9.*|10.*|11.*|12.*|13.* MIT
v1.1.23 >=7.1.3 5.*|6.*|7.*|8.*|9.*|10.* MIT
v1.1.21 >=7.1.3 5.*|6.*|7.*|8.*|9.*|10.* MIT
v1.1.1 >=7.1.3 5.*|6.*|7.*|8.*|9.*|10.* MIT
v1.1.0 >=7.1.3 5.*|6.*|7.*|8.*|9.*|10.* MIT