Skip to content

palpalani/baylinks-laravel

Repository files navigation

BayLinks Laravel

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

BayLinks PHP SDK for Laravel framework.

BayLinks is a powerful URL shortening and management platform tailored for modern businesses. As a Software as a Service (SaaS) solution, BayLinks empowers organizations to create, customize, and track short links effortlessly. Perfect for marketing campaigns, email newsletters, and internal communications, BayLinks simplifies link sharing and enhances brand visibility. With robust analytics and customizable branding options, BayLinks is the go-to solution for businesses seeking efficient link management and optimization.

Installation

You can install the package via composer:

composer require palpalani/baylinks-laravel

You can publish the config file with:

php artisan vendor:publish --tag="baylinks-laravel-config"

Usage

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>", // required
            "domain" => "<Custom domain>" // optional
        ]
    );
Create a Bulk Short URL:

$bayLinks->createBulkURL()
    ->post(<BAYLINKS_API_KEY>, 
        [
            "destination": [  // required
                "<Source URL>",
                "<Source URL>"
                .
                .
                "<Source URL>"
            ],
            "domain": "<Custom domain>",// optional
            "planet": "jupiter", // optional
            "expire": 0, // optional
            "tag": [] // optional callback data 
        ]
    );

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.