previewlinks/laravel-previewlinks
The official Laravel client for PreviewLinks.io
1,171
| Install | |
|---|---|
composer require previewlinks/laravel-previewlinks |
|
| Latest Version: | v0.5.0 |
| PHP: | ^8.0 |
| Laravel: | 8 – 11 |
| License: | MIT |
| Last Updated: | May 2, 2024 |
| Links: | GitHub · Packagist |
Maintainer: CraftLogan
PreviewLinks for Laravel
This is the official PreviewLinks client for Laravel.
Installation
You can install the package via Composer:
composer require previewlinks/laravel-previewlinks
Usage
Configuration
You can set an API token in your .env by using PREVIEWLINKS_API_TOKEN.
return [
/**
* PreviewLinks API token
*
* Obtain one from https://previewlinks.io/app/account
*/
'api_token' => env('PREVIEWLINKS_API_TOKEN'),
];
Methods
use PreviewLinks\PreviewLinks;
/** @var PreviewLinks $previewlinks */
$previewlinks = app(PreviewLinks::class);
$sites = $previewlinks->listSites();
$site = $previewlinks->showSite(siteId: 1);
$siteTemplates = $previewlinks->listSiteTemplates(siteId: 1);
// This will return a JSON response with the image URL, the request may take 4 to 8 seconds to complete
$downloadableImageUrl = $previewlinks->downloadImage(siteId: 1, templateId: 1, fields: [
'previewlinks:title' => 'Hello from Laravel',
'previewlinks:cta' => 'This is an example',
]);
// This method makes no API requests, we advise to use this over `downloadImage`
$signedImageUrl = $previewlinks->signedImageUrl(templateId: 1, [
'previewlinks:title' => 'Hello from Laravel',
'previewlinks:cta' => 'This is an example',
]);
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.
Related Packages
doctrine/dbal
Powerful PHP database abstraction layer (DBAL) with many features for database s...
644,549,754
9,698
laravel/serializable-closure
Laravel Serializable Closure provides an easy and secure way to serialize closur...
423,477,751
607
Version History
| Version | Released | PHP | Laravel | License |
|---|---|---|---|---|
| v0.5.0 | ^8.0 | ^8.73| | MIT | |
| v0.4.0 | ^8.0 | ^8.73| | MIT | |
| v0.3.0 | ^8.0 | ^8.73| | MIT |