Giter Club home page Giter Club logo

autotweet-for-laravel's Introduction

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.

autotweet-for-laravel's People

Contributors

claraleigh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.