Download the PHP package ozankurt/laravel-modules-forum without Composer

On this page you can find all versions of the php package ozankurt/laravel-modules-forum. 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-modules-forum

laravel-modules-forum

tests

Community forum module for Laravel: nested boards containing threads of replies, with up/down voting, a moderation queue, per-thread/board subscriptions, and gamified badges.

Requirements

Installation

Publish config and migrations:

Concepts

What it provides

Best answer (solutions)

A thread can mark one of its own posts as the accepted answer. The pointer lives in forum_threads.solution_post_id (nullable FK to forum_posts, cleared if the post is hard-deleted), so it is the single source of truth — no denormalised flag to drift.

markSolution() rejects a post from another thread (SolutionPostMismatchException). Authorization is handled by the markSolution / unmarkSolution policy abilities: the thread author, or any user granted the canModerateForum gate.

Search

Thread::search(string $term) matches thread titles and their posts' bodies and returns distinct threads (one row per thread via a correlated EXISTS, so a thread with many matching posts still appears once), ranked with title matches first, then most-recently-active.

The scope is portable: on MySQL/MariaDB it uses MATCH ... AGAINST (FULLTEXT) and everywhere else (including the sqlite the test suite runs on) it falls back to a LIKE query — same results, no configuration needed.

The FULLTEXT indexes it relies on are added by an optional migration, add_fulltext_search_indexes_to_forum, on forum_threads.title and forum_posts.body. That migration is a no-op on any non-MySQL/MariaDB driver (so it is safe on sqlite/pgsql), and the LIKE fallback means search works with or without it. Publish and run it if you are on MySQL/MariaDB and want the faster FULLTEXT path.

Denormalisation + recount

Board.thread_count, Board.post_count, Thread.reply_count, Thread.score, and Post.score are denormalised counters. The forum:recount command rebuilds every counter from raw rows when they drift.

Badge engine

ForumServiceProvider binds BadgeAwarder as a singleton, populates it from config('forum.badges.rules'), and listens to every dispatched event via a wildcard Event::listen('*', ...). Inside handleEvent, the awarder iterates rules, resolves the user from the event payload, checks UserBadge for an existing award, and inserts a row plus dispatches BadgeAwarded if the rule evaluates true.

API

The module ships an out-of-the-box JSON REST API built on the Core API kit. It is safe by default: nothing is registered until you opt in.

Enabling it

The surface is gated by forum.http.mode (headless | api | ui). Set the env var to expose it:

headless (the default) registers no routes; api and ui register the endpoints below. The relevant config/forum.php block:

Every route is throttled by the named forum-api limiter (keyed by user id, or client IP for guests) and named under the forum.api. prefix (e.g. route('forum.api.threads.index')).

Auth & policies

Reads are public; writes require authentication (the auth_middleware) and are authorized by the module's Policies via $this->authorize() in the controllers — the same policies used by the Filament admin. Guests hitting a write route get 401; an authenticated but unauthorized user gets 403. Moderators (granted the canModerateForum gate) bypass ownership checks.

Responses use the Core envelope: { "data": ... } for single resources, { "data": [...], "meta": { "pagination": ... } } for collections, and { "message": ..., "errors": ... } for failures.

Endpoints

All paths are relative to the api/forum prefix.

Method Path Auth Policy Description
GET boards List boards (guests see public boards only)
GET boards/{board} viewBoard Show a board
POST boards createBoard (moderator) Create a board
PATCH boards/{board} updateBoard (moderator) Update a board
DELETE boards/{board} deleteBoard (moderator) Delete a board
GET threads List threads — filter[board\|author\|solved], sort=created_at\|last_post\|replies (prefix - for desc), per_page, page
GET threads/search?q= Full-text/LIKE search over titles + post bodies
GET threads/{thread} viewThread Show a thread (with board + root post)
POST threads createThread (board open) Create a thread + its root post
PATCH threads/{thread} updateThread (author) Update a thread title
DELETE threads/{thread} deleteThread (author) Delete a thread
POST threads/{thread}/solution markSolution (author) Mark a post (post_id) as the answer
DELETE threads/{thread}/solution unmarkSolution (author) Clear the accepted answer
POST threads/{thread}/subscribe viewThread Subscribe to a thread
DELETE threads/{thread}/subscribe Unsubscribe from a thread
GET threads/{thread}/posts viewThread List a thread's replies (paginated)
POST threads/{thread}/posts replyToThread Post a reply (body, optional parent_id)
PATCH posts/{post} editPost (author, edit window) Edit a reply
DELETE posts/{post} deletePost (author) Delete a reply
POST posts/{post}/vote votePost Vote (value=up\|down)
DELETE posts/{post}/vote votePost Remove your vote

Controllers stay thin over the existing domain (Thread::reply/markSolution/subscribe, Post::vote/unvote, …), so the same events, counters, and badge rules fire whether an action comes through the API, Filament, or your own code.

Filament admin

The package ships parallel admin resource sets for Filament v3, v4, and v5BoardResource, ThreadResource, PostResource, ModerationReportResource, BadgeResource, and UserBadgeResource. The correct set is chosen at runtime from the installed Filament major, so you register a single version-dispatching plugin on your panel:

ForumPlugin::make() resolves to the matching V3/V4/V5 plugin via Kurt\Modules\Core\Support\FilamentVersion. Install whichever Filament major your app uses — the resources require nothing beyond what the module already depends on:

What the resources give you:

Testing

CI runs the same checks on every push and pull request (.github/workflows/tests.yml), against PHP 8.4 / Laravel 13. Static analysis is held at PHPStan level 8; the suite runs on Pest 5.

License

MIT (c) Ozan Kurt


All versions of laravel-modules-forum with dependencies

PHP Build Version
Package Version
Requires php Version ^8.4
cviebrock/eloquent-sluggable Version ^12.0 || ^13.0
illuminate/contracts Version ^13.0
illuminate/database Version ^13.0
illuminate/support Version ^13.0
ozankurt/laravel-modules-core Version ^2.0
ozankurt/laravel-modules-interactions Version ^2.0
spatie/laravel-medialibrary Version ^11.0
spatie/laravel-package-tools Version ^1.93
spatie/laravel-translatable Version ^6.11
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 ozankurt/laravel-modules-forum contains the following files

Loading the files please wait ...