Download the PHP package ghanem/friendship-filament without Composer

On this page you can find all versions of the php package ghanem/friendship-filament. 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 friendship-filament

Friendship for Filament

tests Latest Version on Packagist Total Downloads

A Filament admin panel plugin for ghanem/friendship: browse and moderate friendships, inspect any user's social graph, and see panel stats.

Requirements

The core ghanem/friendship package supports Laravel 10, but Filament itself requires Laravel 11.28+ — so this plugin starts there too, even though the package it wraps goes further back.

Installation

Translations are optional to publish — see Translations & RTL.

Register the plugin in your panel provider:

Configuration

Friendships are polymorphic, so the panel needs to know how to display each model type. Map them in config/friendship-filament.php:

Other keys in the same file:

Label forms

label and fallback_label accept any of:

Form Example config:cache safe
Attribute name 'name' ✅
Invokable class-string \App\Support\UserLabel::class ✅
[class, method] pair [\App\Support\UserLabel::class, 'make'] ✅
Closure fn ($user) => $user->full_name ❌

Do not use closures in production. php artisan config:cache serialises config with var_export() and throws LogicException: Your configuration files are not serializable on any closure — and the error names your config file, not this package. Closures stay supported for local development; use one of the first three forms anywhere config:cache runs.

An invokable class or [class, method] pair is resolved from the container and receives the model:

Types with no entry in models fall back to fallback_label if set, otherwise to User #12-style labels. Rows whose model has been deleted render as deleted_label plus the row's own morph context — `Deleted record (User

12)` — so orphaned rows stay identifiable.

navigation_group and navigation_sort control where FriendshipResource appears in the panel navigation. navigation_group is only used when no FriendshipPlugin registered on the current panel has set one via ->navigationGroup() — see Customising the plugin. There is no plugin-level equivalent for navigation_sort; it is always read from config.

What you get

Friendships Resource

A read-only moderation table of every friendship: sender, recipient, status badge, and timestamps, filterable by status and sender type. Admins do not create friendships — users do — so there is no create or edit page, only a list and a view page.

Friends relation manager

Add it to your own UserResource to see a user's friendships inline:

That's the only step required — the manager builds its own bidirectional query and doesn't need a friendships() relation on your model. It lists friendships in both directions — rows where the user sent the request and rows where they received it — showing the other party and whether the friendship was incoming or outgoing.

Its visibility follows your app's own authorization: if you register a policy for Ghanem\Friendship\Models\Friendship, the relation manager is shown only when viewAny is allowed; if you don't register one, it's shown by default.

Moderation actions

Action Applies to Effect
Approve request Pending Accepts on the recipient's behalf
Unfriend Accepted Removes the friendship for both people
Lift block Blocked Lifts the block as the blocker

Each requires confirmation and is hidden when it doesn't apply. All of them go through the core package's public API (acceptFriendRequest(), unfriend(), unblock()), so your event listeners still fire. Available on both the Resource's table and the relation manager's table.

Widgets

FriendshipStatsWidget (accepted, pending, blocked counts) and FriendshipsChartWidget (accepted friendships formed per day, last 30 days). Both are registered by default; opt out with ->widgets(false).

Translations & RTL

Every string the plugin renders goes through Laravel's translator. English and Arabic ship with the package; the panel follows your app locale, and Filament flips the whole panel to RTL on its own for RTL locales (the plugin ships no views or CSS of its own, so there is nothing to mirror).

Override the wording, or add a locale:

That writes lang/vendor/friendship-filament/{locale}/friendship.php. To add a language, copy the en directory to your locale code and translate the values.

Two keys are deliberately placeholder-driven rather than concatenated in PHP, so translators control word order — which matters under RTL:

deleted_label in the config file defaults to null, meaning "use the translation". Setting it to a string overrides every locale with one fixed wording — useful only if you do not run a multilingual panel.

Customising the plugin

Authorization

No policy ships with this package. Register your own policy for Ghanem\Friendship\Models\Friendship and Filament — and the relation manager's own visibility check (see above) — will honour it. Moderation actions are destructive — gate them deliberately.

Note that FriendsRelationManager overrides canViewForRecord(), so the inherited skipAuthorization() / checkPolicyExistence() toggles do not affect whether its tab is visible; that is decided solely by the override described above. Those toggles still apply to row-level actions inside the relation manager.

Testing

Related packages

License

MIT. See LICENSE.


All versions of friendship-filament with dependencies

PHP Build Version
Package Version
Requires php Version ^8.2
ghanem/friendship Version ^2.1
filament/filament Version ^4.0|^5.0
illuminate/support Version ^11.28|^12.0|^13.0
spatie/laravel-package-tools Version ^1.16
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 ghanem/friendship-filament contains the following files

Loading the files please wait ...