Skip to content

Commit

Permalink
documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePlatinum committed Feb 10, 2024
1 parent 90465a7 commit 6263079
Show file tree
Hide file tree
Showing 5 changed files with 95 additions and 9 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@ To install Laravel Link Preview, run the following command in your terminal:
composer require teners/laravel-link-preview
```

<!-- Publish the package configuration file
Publish the package configuration file
```bash
php artisan vendor:publish --provider="" --tag="config"
``` -->
php artisan vendor:publish --provider="Teners\LaravelLinkPreview\LaravelLinkPreviewServiceProvider" --tag="link-preview-config"
```

## Contents
1. [Use Cases](docs/use-cases.md)
2. [Configuration Options](docs/configuration.md)

## Contributions
Contributions are **welcome** via Pull Requests on [Github](https://github.com/Teners-net/laravel-link-preview).
- Please document any change you made as neccesary in the [README.md](README.md).
- Pleas make only one pull request per feature/fix.
- See below for some ideas on what you can help with.
- Add Other Parsers:
- Youtube
- Vimeo
- Add JSReader with Puppeteer
- See below for some ideas on what you can help with here: [Todos](TODO.md)

## Issues
Please report any issue you encounter in using the package through the [Github Issues](https://github.com/Teners-net/laravel-link-preview/issues) tab.
Expand Down
10 changes: 10 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# TODO:

See below for some ideas on what you can help with.

- Add Other Parsers to extrack videos:
- Youtube
- Vimeo
- Add JSReader with Puppeteer
- Check for image sizes and set a minimum for quality
- Fix: x/twitter links fails with 400: Bad Request (browser incompatible)
3 changes: 2 additions & 1 deletion config/link-preview.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* COMING SOON:
* 'global': a redix server maintained cache with CDN
*/
'cache_type' => env('LINK_PREVIEW_CACHE_TYPE', 'app'),
'cache_type' => env('LINK_PREVIEW_CACHE_TYPE', 'model'),

/**
* Enable or disable specific parsers for link preview generation.
Expand All @@ -34,6 +34,7 @@
*
* COMING_SOON
*/
/** @todo */
'enabled_parsers' => [
// 'youtube' => env('LINK_PREVIEW_PARSER_YOUTUBE', false),
// 'vimeo' => env('LINK_PREVIEW_PARSER_VIMEO', false),
Expand Down
30 changes: 30 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Configuration Options

The `link-preview.php` configuration file in your Laravel application's `config` directory contains various options that you can customize to tailor the behavior of the Laravel Link Preview package to your needs.

## `enable_caching`

- **Description**: Enable or disable caching of link previews.
- **Type**: Boolean
- **Default**: `true`

## `cache_duration`

- **Description**: Set the duration in seconds for which link previews should be cached.
- **Type**: Integer
- **Default**: `604800` (1 week)

## `cache_type`

- **Description**: Choose the type of cache type to use for storing link previews.
- **Type**: String
- **options**: `'model'`, `'app'`
- **Default**: `'model'`


### How to Customize Configuration

To customize these options, you can modify the `link-preview.php` file located in the `config` directory of your Laravel application. After making changes, be sure to clear the config cache:

```bash
php artisan config:cache
45 changes: 45 additions & 0 deletions docs/use-cases.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Laravel Link Preview Use Cases

The Laravel Link Preview package provides a powerful solution for extracting link previews within Laravel applications. Below are some common use cases where this package can be valuable:

## 1. Displaying Link Previews in Content Management Systems (CMS)

### Scenario:
You have a content management system where users can input and manage content that includes external links. Enhance the user experience by automatically generating and displaying link previews for these URLs.

### Implementation:
Integrate the Laravel Link Preview package to parse external links within your CMS and dynamically fetch and display link previews alongside the content.

## 2. Social Media Sharing

### Scenario:
You are building a social media platform or application where users share links. Provide a visually appealing presentation of shared links by generating link previews for URLs shared within posts or comments.

### Implementation:
Use the Laravel Link Preview package to extract link previews when users share URLs on your social media platform, making the shared content more engaging.

## 3. Customized Link Preview Widgets

### Scenario:
You want to create a customized link preview widget or component that you can reuse across different parts of your Laravel application.

### Implementation:
Leverage the Laravel Link Preview package to easily fetch and display link previews within your custom widgets or components, ensuring a consistent and aesthetically pleasing design.

## 4. Generating Rich Media Previews in Messaging Apps

### Scenario:
You are developing a messaging application where users can send links to each other. Enhance the messaging experience by automatically generating and displaying rich link previews for shared URLs.

### Implementation:
Integrate the Laravel Link Preview package to parse links within messages and generate visually appealing link previews, providing users with more context about the shared content.

## 5. Content Aggregation Platforms

### Scenario:
You are building a content aggregation platform that collects and displays content from various sources. Provide users with a preview of external content by generating link previews for aggregated links.

### Implementation:
Incorporate the Laravel Link Preview package into your content aggregation platform to enhance the presentation of external content, making it more attractive and informative.

Feel free to explore these use cases and adapt the Laravel Link Preview package to suit your specific application requirements.

0 comments on commit 6263079

Please sign in to comment.