falcon758/ laravelsocial
Laravel 社交自动发布(Larasap)允许您自动将所有内容发布到社交网络,如Telegram频道和Twitter。
1.1
2020-03-29 01:28 UTC
Requires
- php: >=7.0
- facebook/graph-sdk: ^5.7
- illuminate/support: *
Requires (Dev)
- phpunit/phpunit: ~4.8
This package is auto-updated.
Last update: 2024-09-19 20:45:22 UTC
README
🌈 简介
这是一个Laravel包,可以将您的内容发布到社交网络,如
- Telegram频道(基于Telegram机器人API)
🚀 特性
- 🍒 简单。易于使用。
- 📝 向Telegram频道发送文本消息
- 📷 向Telegram频道发送照片
- 🎵 向Telegram频道发送音频
- 📖 向Telegram频道发送文档
- 📺 向Telegram频道发送视频
- 🔊 向Telegram频道发送语音
- 🎴 将一组照片或视频作为相册发送到Telegram频道
- 📍 向Telegram发送位置
- 📌 向Telegram发送地点
- 📞 向Telegram发送联系人
- 🌐 向Telegram频道发送带有内联键盘的消息
- ✨ 向Twitter发送文本和媒体
- 🎉 向Facebook发送文本和媒体
🔨 安装
- 通过composer下载并安装包
composer require falcon758/laravelsocial
- 运行以下命令发布包配置文件:
config\larasap.php
php artisan vendor:publish --tag=larasap
🔌 配置
在config\larasap.php
中设置社交网络信息。
🕹 使用
首先,在您的控制器中添加use Toolkito\Larasap\SendTo;
。
接下来,向您的Telegram频道或Twitter账户发送消息。
🚩 路线图
- 改进测试和覆盖率
- 提高性能
🌱 快速示例
⭐ Telegram示例
📝 向Telegram发送文本消息
SendTo::Telegram('Hello, I\'m testing Laravel social auto posting');
📷 向Telegram发送照片
SendTo::Telegram( 'Hello, I\'m testing Laravel social auto posting', // Photo caption (Optional) [ 'type' => 'photo', // Message type (Required) 'file' => 'https://i.imgur.com/j6bzKQc.jpg' // Image url (Required) ], '' // Inline keyboard (Optional) );
🎵 向Telegram发送音频
SendTo::Telegram( 'Hello, I\'m testing Laravel social auto posting', // Audio caption (Optional) [ 'type' => 'audio', // Message type (Required) 'file' => 'http://example.com/let-me-be-your-lover.mp3', // Audio url (Required) 'duration' => 208, // Duration of the audio in seconds (Optional) 'performer' => 'Enrique Iglesias', // Performer (Optional) 'title' => 'Let Me Be Your Lover' // Track name (Optional) ], '' // Inline keyboard (Optional) );
📖 向Telegram发送文档
SendTo::Telegram( 'Hello, I\'m testing Laravel social auto posting', // Document caption [ 'type' => 'document', // Message type (Required) 'file' => 'http://example.com/larasap.pdf', // Document url (Required) ], '' // Inline keyboard (Optional) );
📺 向Telegram发送视频
SendTo::Telegram( 'Hello, I\'m testing Laravel social auto posting', // Video caption (Optional) [ 'type' => 'video', // Message type (Required) 'file' => 'http://example.com/let-me-be-your-lover.mp4', // Audio url (Required) 'duration' => 273, // Duration of sent video in seconds (Optional) 'width' => 1920, // Video width (Optional) 'height' => 1080 // Video height (Optional) ], '' // Inline keyboard (Optional) );
🔊 向Telegram发送语音
SendTo::Telegram( 'Hello, I\'m testing Laravel social auto posting', // Voice message caption (Optional) [ 'type' => 'voice', // Message type (Required) 'file' => 'https://upload.wikimedia.org/wikipedia/en/9/9f/Sample_of_%22Another_Day_in_Paradise%22.ogg', // Audio url (Required) 'duration' => 28 // Duration of the voice message in seconds (Optional) ], '' // Inline keyboard (Optional) );
🎴 向Telegram发送媒体组
SendTo::Telegram( null, [ 'type' => 'media_group', // Message type (Required) 'files' => // Array describing photos and videos to be sent, must include 2–10 items [ [ 'type' => 'photo', // Media type (Required) 'media' => 'https://i.imgur.com/j6bzKQc.jpg', // Media url (Required) 'caption' => 'Laravel sccial auto posting' // Media caption (Optional) ], [ 'type' => 'video', // Media type (Required) 'media' => 'http://example.com/let-me-be-your-lover.mp4', // Media url (Required) 'caption' => 'Let me be your lover' // Media caption (Optional) ] ] ] );
📍 向Telegram发送地图上的点
SendTo::Telegram( null, [ 'type' => 'location', // Message type (Required) 'latitude' => 36.1664345, // Latitude of the location (Required) 'longitude' => 58.8209904, // Longitude of the location (Required) 'live_period' => 86400, // Period in seconds for which the location will be updated (Optional) '' // Inline keyboard (Optional) );
📌 向Telegram发送地点信息
SendTo::Telegram( null, [ 'type' => 'venue', // Message type (Required) 'latitude' => 36.166048, // Latitude of the location (Required) 'longitude' => 58.822121, // Longitude of the location (Required) 'title' => 'Khayyam', // Name of the venue (Required) 'address' => 'Neyshabur, Razavi Khorasan Province, Iran', // Address of the venue (Required) 'foursquare_id' => '', // Foursquare identifier of the venue (Optional) '' // Inline keyboard (Optional) );
📞 向Telegram发送电话联系人
SendTo::Telegram( null, [ 'type' => 'contact', // Message type (Required) 'phone_number' => '+12025550149', // Contact's phone number (Required) 'first_name' => 'John', // Contact's first name (Required) 'last_name' => 'Doe', // Contact's last name (Optional) '' // Inline keyboard (Optional) ] );
🌐 向Telegram发送带有内联按钮的消息
SendTo::Telegram( 'Laravel social auto posting', '', [ [ [ 'text' => 'Github', 'url' => 'https://github.com/toolkito/laravel-social-auto-posting' ] ], [ [ 'text' => 'Download', 'url' => 'https://github.com/toolkito/laravel-social-auto-posting/archive/master.zip' ], ] ] );
或者
SendTo::Telegram( 'Laravel social auto posting', '', [ [ [ 'text' => 'Github', 'url' => 'https://github.com/toolkito/laravel-social-auto-posting' ], [ 'text' => 'Download', 'url' => 'https://github.com/toolkito/laravel-social-auto-posting/archive/master.zip' ], ] ] );
⭐ Twitter示例
✨ 文本推文
SendTo::Twitter('Hello, I\'m testing Laravel social auto posting');
✨ 带媒体推文
SendTo::Twitter( 'Hello, I\'m testing Laravel social auto posting', [ public_path('photo-1.jpg'), public_path('photo-2.jpg') ] );
⭐ Facebook示例
🎉 向Facebook页面发送链接
SendTo::Facebook( 'link', [ 'link' => 'https://github.com/toolkito/laravel-social-auto-posting', 'message' => 'Laravel social auto posting' ] );
🎉 向Facebook页面发送照片
SendTo::Facebook( 'photo', [ 'photo' => public_path('img/1.jpg'), 'message' => 'Laravel social auto posting' ] );
🎉 向Facebook页面发送视频
SendTo::Facebook( 'video', [ 'video' => public_path('upload/1.mp4'), 'title' => 'Let Me Be Your Lover', 'description' => 'Let Me Be Your Lover - Enrique Iglesias' ] );