claraleigh / autotweet-for-laravel
Auto tweets for Laravel using OAuth
Fund package maintenance!
ClaraLeigh
Installs: 1 140
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 1
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-11-08 17:17:07 UTC
README
This package provides a Twitter channel for Laravel notifications, allowing you to send tweets from your application.
Support us
Hi there! If you're using this package, please consider supporting me on GitHub Sponsors. It would mean a lot to me.
Installation
You can install the package via composer:
composer require claraleigh/autotweet-for-laravel
You can publish and run the migrations with:
php artisan vendor:publish --tag="autotweet-for-laravel-migrations"
php artisan migrate
Update your user model's casts to include the twitter_token
field:
$casts = [ // Existing casts 'twitter_token' => 'object', ];
You can publish the config file with:
php artisan vendor:publish --tag="autotweet-for-laravel-config"
Usage
Update your Notification file's via
method to include the Twitter channel:
public function via(object $notifiable): array { return [TwitterChannel::class]; }
Add a toTwitter
method to your Notification file:
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; }
Alternative User Model
To change the default user model, update the table used in the migration file and add the following code to your service provider:
AutotweetForLaravelServiceProvider::useUserModel(ExampleModel::class);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
Initially based on Laravel Twitter Channel
License
The MIT License (MIT). Please see License File for more information.