PHP code example of toneflix-code / cuttly-php

1. Go to this page and download the library: Download toneflix-code/cuttly-php 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/ */

    

toneflix-code / cuttly-php example snippets


use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly(
    apiKey: '121hksdSome23hRandom19212RegularApiKeyString55',
    teamApiKey: 'hksd092uSome00uRandom101nTeamApiKeyStrings31'
);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://toneflix.com.ng/learning';
$data = $cutly->regular()->shorten($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://toneflix.com.ng/learning';
$data = $cutly->regular()->name('toneflix101')->shorten($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://cutt.ly/toneflix101';
$data = $cutly->regular()->edit($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://cutt.ly/toneflix101';
$data = $cutly->regular()->name('toneflix404')->userDomain()->unique(1)->edit($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://cutt.ly/toneflix404';
$data = $cutly->regular()->stats($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://cutt.ly/toneflix404';
$data = $cutly->regular()->delete($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://toneflix.com.ng/learning';
$data = $cutly->team()->name('toneflix301')->shorten($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://cutt.ly/toneflix301';
$data = $cutly->team()->edit($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://cutt.ly/toneflix301';
$data = $cutly->team()->stats($link);

use ToneflixCode\CuttlyPhp\Cuttly;

$cutly = new Cuttly();

$link = 'https://cutt.ly/toneflix404';
$data = $cutly->team()->delete($link);

use ToneflixCode\CuttlyPhp\Cuttly;
use ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException;

$cutly = new Cuttly();

try {
  $link = 'https://toneflix.com.ng/learning';
  $data = $cutly->regular()->name('toneflix404')->shorten($link);
} catch (FailedRequestException $th) {
  echo $th->getMessage();
}

use ToneflixCode\CuttlyPhp\Cuttly;
use ToneflixCode\CuttlyPhp\Exceptions\InvalidApiKeyException;
use ToneflixCode\CuttlyPhp\Exceptions\FailedRequestException;

try {
  $cutly = new Cuttly();

  $link = 'https://toneflix.com.ng/learning';
  $data = $cutly->regular()->name('toneflix404')->shorten($link);
} catch (FailedRequestException|InvalidApiKeyException $th) {
  echo $th->getMessage();
}