prashantdhungana/social-embed 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

prashantdhungana/social-embed

最新稳定版本:1.0.0

Composer 安装命令:

composer require prashantdhungana/social-embed

包简介

Embed Youtube and Tiktok videos as an iframe

README 文档

README

The SocialEmbed plugin is a custom Filament form component that allows users to embed TikTok and YouTube videos by providing a URL. This component extends the TextInput component from the Filament Forms library.

Features

  • Supports embedding videos from TikTok and YouTube.
  • Customizable width and height for the embedded video.
  • Automatic URL processing to generate the correct embed link.
  • Live validation and updating of the embed link.
  • Notification support for unsupported video platforms.

Installation

  1. Require the plugin via Composer:

    composer require prashantdhungana/social-embed
  2. Add the SocialEmbed component to your form:

    use PrashantDhungana\SocialEmbed\SocialEmbed;
    
    SocialEmbed::make('video');

Usage

Basic Usage

To use the SocialEmbed component in your form, simply call the make method and pass the name of the field:

```php
use PrashantDhungana\SocialEmbed\SocialEmbed;

SocialEmbed::make('video');
```

This will create a text input field with a placeholder prompting the user to enter a TikTok or YouTube video URL.

Customizing Dimensions

You can customize the width and height of the embedded video using the width and height methods:

```php
use PrashantDhungana\SocialEmbed\SocialEmbed;

SocialEmbed::make('video_url')
    ->width('80%')
    ->height('400');
```

Notifications

If the provided URL is from an unsupported video platform, a notification will be displayed to the user.

Methods

make(string $name): static Creates a new instance of the SocialEmbed component.

width(string $width): static Sets the width of the embedded video. Accepts a string representing the width (e.g., '100%').

height(string $height): static Sets the height of the embedded video. Accepts a string representing the height (e.g., '500').

getWidth(): string Returns the current width of the embedded video.

getHeight(): string Returns the current height of the embedded video.

Processing Links

The processLink method automatically processes the provided URL and generates the appropriate embed link. If the URL is not supported, a notification will be sent to the user.

Supported Platforms

  • TikTok
  • YouTube

Example URL Formats

  • Tiktok: https://www.tiktok.com/@username/video/123456789
  • Youtube: https://www.youtube.com/watch?v=abcdefghijk, https://youtu.be/abcdefghijk, https://www.youtube.com/embed/abcdefghijk

License

This project is open-source and available under the MIT License.

Contributing

Contributions are welcome! Please submit a pull request or open an issue to discuss any changes.

Credits

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: Blade

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-07-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固