PHP code example of palpalani / baylinks-laravel

1. Go to this page and download the library: Download palpalani/baylinks-laravel 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/ */

    

palpalani / baylinks-laravel example snippets


Update the server information:

return [

    /**
     * BayLinks URL.
     */
    'server' => env('BAYLINKS_SERVER'),

    /**
     * Rest API version of BayLinks.
     */
    'api' => [
        'url' => 'api/v1',
    ],
];

Get the account Information:

$bayLinks = BayLinks::client();
$bayLinks->accountDetails()->get(<BAYLINKS_API_KEY>);


Create a Single Short URL:

$bayLinks->createShortURL()
    ->post(<BAYLINKS_API_KEY>, 
        [
            "destination" => "<Source URL>", // 

Create a Bulk Short URL:

$bayLinks->createBulkURL()
    ->post(<BAYLINKS_API_KEY>, 
        [
            "destination": [  // >"
            ],
            "domain": "<Custom domain>",// optional
            "planet": "jupiter", // optional
            "expire": 0, // optional
            "tag": [] // optional callback data 
        ]
    );
bash
php artisan vendor:publish --tag="baylinks-laravel-config"