1. Go to this page and download the library: Download tousanco/laravel-zaya library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
tousanco / laravel-zaya example snippets
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);