Download the PHP package truefanspace/laravel-react-reactions without Composer

On this page you can find all versions of the php package truefanspace/laravel-react-reactions. 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-react-reactions

Laravel React Reactions

A complete Facebook-like reaction and commenting system for Laravel with Inertia.js and React. Add reactions, comments with nested replies, and toast notifications to any Eloquent model.

Features

Requirements

Installation

Publishing Assets

You can publish all package assets at once or individually:

Publish everything (recommended for first-time setup):

Or publish individually:

Available tags:

Quick Start

1. Add Traits to Your Model

2. Setup Controller with Query Optimization

3. Setup Inertia Middleware

4. Use React Components

Query Optimization Guide

The N+1 Problem

โŒ BAD: This creates N+1 queries

โœ… GOOD: This uses 1 query

How It Works

The withReactionsData() scope adds SQL subqueries to aggregate reactions at the database level:

This executes as one query regardless of how many posts you load.

Performance Comparison

Dataset Without Optimization With withReactionsData()
10 posts 21 queries 1 query
100 posts 201 queries 1 query
1000 posts 2001 queries 1 query

Comments Optimization

โŒ BAD: Loading comments per post in a loop

โœ… GOOD: Load all comments at once

Key Optimization Rules

  1. Always use withReactionsData() when loading multiple models
  2. Eager load relationships with with() to avoid N+1
  3. Use withCount() instead of count() in loops
  4. Batch load related data before mapping
  5. Avoid calling methods on models in loops that trigger queries
  6. Monitor queries with Laravel Debugbar in development

Configuration

Customizing Reaction Types

All reaction types are configurable in config/react-reactions.php. The frontend automatically reads from this config:

Important: The reaction types are shared with the frontend via Inertia middleware. Make sure to add this to your HandleInertiaRequests:

This ensures the frontend always uses the same reaction types as the backend, maintaining consistency across your application.

API Reference

HasReactions Trait

HasComments Trait

Comment Model

TypeScript Support

All React components are written in TypeScript with full type safety. The package includes:

Component Type Definitions

Using with TypeScript

Testing

Troubleshooting

N+1 Query Issues

Reactions Not Working

Comments Not Showing

License

MIT License. See License File for details.

Credits


All versions of laravel-react-reactions with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
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 truefanspace/laravel-react-reactions contains the following files

Loading the files please wait ...