claraleigh/autotweet-for-laravel

Auto tweets for Laravel using OAuth
20,248
Install
composer require claraleigh/autotweet-for-laravel
Latest Version:v0.0.7
PHP:^8.2
Laravel:10 – 13
License:MIT
Last Updated:Jun 19, 2026
Links: GitHub  ·  Packagist
Maintainer: clara_leigh

Auto tweets for Laravel using OAuth

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

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.

Related Packages

socialiteproviders/twitter

Twitter OAuth1 Provider for Laravel Socialite

1,645,164 25
despark/laravel-social-feeder

Social feeder for laravel. With this you can get feed from facebook page, twitte...

134 13
arcanedev/seo-helper

SEO Helper is a framework agnostic package that provides tools & helpers for SEO...

478,154 331
codezero/twitter

Simple Twitter API wrapper

40,024 1
philo/laravel-twitter

A simple Laravel 4 service provider for including the TwitterOAuth library.

19,952 43

Version History

Version Released PHP Laravel License
v0.0.7 ^8.2 ^10.0||^11.0||^12.0||^13.0 MIT
v0.0.6 ^8.2 ^10.0||^11.0||^12.0||^13.0 MIT
v0.0.5 ^8.2 ^10.0||^11.0 MIT
v0.0.4 ^8.2 ^10.0||^11.0 MIT
v0.0.3 ^8.2 ^10.0||^11.0 MIT