claraleigh / autotweet-for-laravel
使用OAuth的Laravel自动推文
v0.0.5
2024-05-13 04:19 UTC
Requires
- php: ^8.2
- abraham/twitteroauth: ^7.0
- illuminate/contracts: ^10.0||^11.0
- kylewm/brevity: ^0.2.10
- spatie/laravel-package-tools: ^1.16
Requires (Dev)
- larastan/larastan: ^2.9
- laravel/pint: ^1.14
- nunomaduro/collision: ^8.1.1||^7.10.0
- orchestra/testbench: ^9.0.0||^8.22.0
- pestphp/pest: ^2.34
- pestphp/pest-plugin-arch: ^2.7
- pestphp/pest-plugin-laravel: ^2.3
- phpstan/extension-installer: ^1.3
- phpstan/phpstan-deprecation-rules: ^1.1
- phpstan/phpstan-phpunit: ^1.3
- roave/security-advisories: dev-latest
- spatie/laravel-ray: ^1.35
This package is auto-updated.
Last update: 2024-09-08 16:49:56 UTC
README
此包为Laravel通知提供Twitter渠道,允许您从应用程序发送推文。
支持我们
你好!如果你在使用此包,请考虑在 GitHub Sponsors 上支持我。这对我会意义重大。
安装
您可以通过composer安装此包
composer require claraleigh/autotweet-for-laravel
您可以使用以下命令发布和运行迁移
php artisan vendor:publish --tag="autotweet-for-laravel-migrations"
php artisan migrate
更新您的用户模型以包括twitter_token
字段
$casts = [ // Existing casts 'twitter_token' => 'object', ];
您可以使用以下命令发布配置文件
php artisan vendor:publish --tag="autotweet-for-laravel-config"
使用
更新您的通知文件的via
方法以包含Twitter渠道
public function via(object $notifiable): array { return [TwitterChannel::class]; }
在您的通知文件中添加一个toTwitter
方法
public function toTwitter($notifiable): TwitterMessage { $post = (new TwitterStatusUpdate( __('Come see visit profile :url ❤️', ['url' => 'https://google.com/']) )); // Optional: Add an image to the tweet $post->withImage('path/to/image.jpg'); return $post; }
替代用户模型
要更改默认用户模型,更新迁移文件中使用的表,并在您的服务提供者中添加以下代码
AutotweetForLaravelServiceProvider::useUserModel(ExampleModel::class);
测试
composer test
变更日志
请参阅 CHANGELOG 以获取有关最近更改的更多信息。
贡献
请参阅 CONTRIBUTING 以获取详细信息。
安全漏洞
请参阅 我们的安全策略 了解如何报告安全漏洞。
致谢
许可证
MIT许可证(MIT)。请参阅 许可证文件 以获取更多信息。