Download the PHP package ritechoice23/laravel-followable without Composer

On this page you can find all versions of the php package ritechoice23/laravel-followable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package laravel-followable

Laravel Followable

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

The only fully polymorphic follow package that handles mixed follower types elegantly with metadata support.

A modern Laravel package that adds follow/unfollow functionality to Eloquent models with true bidirectional polymorphism. Any model can follow any other model, with intelligent handling of mixed-type relationships and optimized queries.

Why This Package?

While other popular packages like overtrue/laravel-follow and rennokki/laravel-eloquent-interactions offer basic follow functionality, they often force you to hardcode the User model or require complex workarounds for heterogeneous relationships.

Laravel Followable was built to solve real-world challenges in complex applications where:

What Makes It Unique

True Bidirectional Polymorphism - Both follower AND followable can be ANY model type (User→Team, Team→Team, Organization→User, etc.)

Intelligent Mixed-Type Handling - Smart MixedModelsCollection for when followers are of different types (Users + Teams + Organizations)

Rich Metadata Support - Attach JSON metadata to track source, campaign data, referrer, or any custom attributes

Flexible Query API - Separate optimized methods for single-type (followers()) vs multi-type (followersGrouped()) scenarios

Mutual Relationships - Built-in support for identifying mutual follows and connections

Full MorphMap Support - Works seamlessly with Laravel's Relation::morphMap() for cleaner database storage

Modern Architecture - Uses latest Laravel features with 100+ comprehensive tests using Pest PHP

Features

Installation

Install the package via composer:

Publish and run the migrations:

Optionally, publish the config file:

Configuration

The published config file (config/follow.php) includes:

Usage

Setup Models

Add traits to your models:

Basic Operations

Working with Followers

Get Actual Follower Models

The followers() method returns actual follower models (User, Team, etc.), not Follow pivot records:

Handling Mixed Follower Types

When a model has followers of different types (e.g., both Users and Teams), use followersGrouped():

Counting Followers

Access Follow Pivot Records

When you need the actual Follow records (e.g., for metadata):

Follow with Metadata

Attach custom data to follows:

Query Scopes

Find models based on follow relationships:

Polymorphic Follows

Follow any model type:

Relationships

Access follow relationships:

Working with Followings

The CanFollow trait provides powerful methods to query what models a user is following.

Get Actual Followable Models

The followings() method returns actual followable models (User, Team, etc.), not Follow pivot records:

Handling Mixed Followable Types

When a user follows different types of models (e.g., both Users and Teams), use followingsGrouped():

Counting Followings

Access Following Records

When you need the actual Follow records (e.g., for metadata):

Important Notes

Use Cases for Different Methods

For Followers (HasFollowers trait):

Use followers() when:

Use followersGrouped() when:

Use followRecords when:

For Followings (CanFollow trait):

Use followings() when:

Use followingsGrouped() when:

Use followingRecords when:

Performance Considerations

The package uses optimized database queries with negligible overhead:

Benchmark Results (50 followings, mixed types):

💡 Pro Tip: For mixed-type scenarios, followingsGrouped() is 4x faster than followings()->get()

Working with Mixed Follower Types

If your model can be followed by different types (polymorphic scenario):

Advanced Usage

Prevent Self-Following

By default, models cannot follow themselves. Enable it in config if needed:

Idempotent Operations

Following an already-followed model returns false without creating duplicates:

Database Indexes

The migration includes optimized indexes for performance:

Testing

Run the test suite:

Run tests with coverage:

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

License

The MIT License (MIT). Please see License File for more information.


All versions of laravel-followable with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
spatie/laravel-package-tools Version ^1.16
illuminate/contracts Version ^11.0||^12.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package ritechoice23/laravel-followable contains the following files

Loading the files please wait ...