PHPackages                             samkumar/testimonials - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Framework](/categories/framework)
4. /
5. samkumar/testimonials

ActiveLibrary[Framework](/categories/framework)

samkumar/testimonials
=====================

Advanced Laravel Testimonials Package with API, Blade views, Spatie Permissions, photos, ratings, and more

00PHP

Since Nov 18Pushed 6mo agoCompare

[ Source](https://github.com/shivam0214/Testimonials)[ Packagist](https://packagist.org/packages/samkumar/testimonials)[ RSS](/packages/samkumar-testimonials/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)DependenciesVersions (1)Used By (0)

Testimonials Package
====================

[](#testimonials-package)

A comprehensive Laravel package for managing testimonials with advanced features including photos, ratings, locations, permissions management, API endpoints, and Blade views.

Features
--------

[](#features)

- ✨ **Rich Testimonial Data**: Names, photos, locations, ratings, company info, designations
- 📸 **Photo Uploads**: Store and manage testimonial photos
- ⭐ **Star Ratings**: 1-5 star rating system
- 🔒 **Permission Management**: Built-in Spatie Laravel Permission integration
- 🌐 **RESTful API**: Complete JSON API for testimonials
- 🎨 **Blade Views**: Pre-built views for displaying testimonials
- 📊 **Moderation**: Approve/reject testimonials workflow
- 🔍 **Search &amp; Filter**: Filter by location, company, rating, status
- 👁️ **View Tracking**: Track number of views per testimonial
- 🗑️ **Soft Deletes**: Soft delete support
- 📱 **Responsive Design**: Mobile-friendly templates

Installation
------------

[](#installation)

### Via Packagist (Recommended)

[](#via-packagist-recommended)

```
composer require samkumar/laravel-testimonials
```

Or for development version:

```
composer require samkumar/laravel-testimonials:dev-master
```

### From GitHub (Alternative)

[](#from-github-alternative)

```
composer require samkumar/laravel-testimonials:dev-main --dev
```

### 1. Install the Package

[](#1-install-the-package)

```
composer require samkumar/laravel-testimonials
```

### 2. Publish Configuration

[](#2-publish-configuration)

```
php artisan vendor:publish --provider="samkumar\Testimonials\TestimonialsServiceProvider" --tag="testimonials-config"
```

### 3. Publish Migrations

[](#3-publish-migrations)

```
php artisan vendor:publish --provider="samkumar\Testimonials\TestimonialsServiceProvider" --tag="testimonials-migrations"
```

### 4. Publish Views (Optional)

[](#4-publish-views-optional)

```
php artisan vendor:publish --provider="samkumar\Testimonials\TestimonialsServiceProvider" --tag="testimonials-views"
```

### 5. Run Migrations

[](#5-run-migrations)

```
php artisan migrate
```

### 6. Seed Permissions (Optional)

[](#6-seed-permissions-optional)

```
php artisan db:seed --class="samkumar\Testimonials\Database\Seeders\TestimonialsPermissionSeeder"
```

### 7. Seed Dummy Data (Optional)

[](#7-seed-dummy-data-optional)

```
php artisan db:seed --class="samkumar\Testimonials\Database\Seeders\TestimonialsSeeder"
```

Configuration
-------------

[](#configuration)

The package configuration file is located at `config/testimonials.php`. Key configuration options:

```
return [
    'moderation_enabled' => true,           // Enable moderation
    'per_page' => 15,                       // Pagination per page
    'storage_path' => 'testimonials',       // Storage path for photos
    'max_photo_size' => 2,                  // Max photo size (MB)
    'enable_ratings' => true,               // Enable rating system
    'track_views' => true,                  // Track page views
    'soft_deletes' => true,                 // Enable soft deletes
];
```

Database Schema
---------------

[](#database-schema)

### Testimonials Table

[](#testimonials-table)

```
id                    - bigint (primary key)
user_id              - bigint (nullable, foreign key)
name                 - string
email                - string
location             - string
message              - text
photo                - string (nullable)
rating               - integer (1-5)
status               - enum (pending, approved, rejected)
company_name         - string (nullable)
designation          - string (nullable)
website_url          - string (nullable)
social_links         - text (JSON)
views_count          - integer
soft deletes
timestamps

```

Usage
-----

[](#usage)

### Web Routes

[](#web-routes)

#### Display All Testimonials

[](#display-all-testimonials)

```
GET /testimonials
```

#### View Single Testimonial

[](#view-single-testimonial)

```
GET /testimonials/{id}
```

#### Create Testimonial (Form)

[](#create-testimonial-form)

```
GET /testimonials/create
```

#### Submit Testimonial

[](#submit-testimonial)

```
POST /testimonials
```

#### Update Testimonial

[](#update-testimonial)

```
PUT /testimonials/{id}
```

#### Delete Testimonial

[](#delete-testimonial)

```
DELETE /testimonials/{id}
```

#### Approve Testimonial (Admin)

[](#approve-testimonial-admin)

```
POST /testimonials/{id}/approve
```

#### Reject Testimonial (Admin)

[](#reject-testimonial-admin)

```
POST /testimonials/{id}/reject
```

### API Routes

[](#api-routes)

All API routes are prefixed with `/api/testimonials`

#### List Testimonials

[](#list-testimonials)

```
GET /api/testimonials
```

**Query Parameters:**

- `status` - Filter by status (pending, approved, rejected)
- `rating` - Filter by rating (1-5)
- `location` - Filter by location
- `company` - Filter by company
- `public` - Get only approved (boolean)
- `order_by` - Order by field (created\_at, rating, etc.)
- `order_dir` - Order direction (asc, desc)
- `per_page` - Results per page

**Example:**

```
GET /api/testimonials?status=approved&rating=5&per_page=10
```

#### Get Single Testimonial

[](#get-single-testimonial)

```
GET /api/testimonials/{id}
```

#### Get Statistics

[](#get-statistics)

```
GET /api/testimonials/statistics
```

**Response:**

```
{
  "success": true,
  "data": {
    "total": 20,
    "approved": 15,
    "pending": 3,
    "rejected": 2,
    "average_rating": 4.5,
    "total_views": 1250
  }
}
```

#### Get By Rating

[](#get-by-rating)

```
GET /api/testimonials/rating/{rating}
```

#### Create Testimonial (Authenticated)

[](#create-testimonial-authenticated)

```
POST /api/testimonials
Content-Type: application/json

{
  "name": "John Doe",
  "email": "john@example.com",
  "location": "New York, USA",
  "message": "This is a great service!",
  "rating": 5,
  "photo": "file",
  "company_name": "Tech Corp",
  "designation": "CEO",
  "website_url": "https://example.com",
  "social_links": {
    "twitter": "https://twitter.com/johndoe",
    "linkedin": "https://linkedin.com/in/johndoe"
  }
}
```

#### Update Testimonial (Authenticated)

[](#update-testimonial-authenticated)

```
POST /api/testimonials/{id}
Content-Type: application/json
```

#### Delete Testimonial (Authenticated)

[](#delete-testimonial-authenticated)

```
DELETE /api/testimonials/{id}
```

#### Approve Testimonial (Admin)

[](#approve-testimonial-admin-1)

```
POST /api/testimonials/{id}/approve
```

#### Reject Testimonial (Admin)

[](#reject-testimonial-admin-1)

```
POST /api/testimonials/{id}/reject
```

Blade Views
-----------

[](#blade-views)

### Display All Testimonials

[](#display-all-testimonials-1)

```
@include('testimonials::index', ['testimonials' => $testimonials])
```

### Display Single Testimonial

[](#display-single-testimonial)

```
@include('testimonials::show', ['testimonial' => $testimonial])
```

### Display Form

[](#display-form)

```
@include('testimonials::create')
```

### Custom Usage

[](#custom-usage)

```
@foreach($testimonials as $testimonial)

        {{ $testimonial->name }}
        {{ $testimonial->message }}
        Rating: {{ $testimonial->rating }}/5
        Location: {{ $testimonial->location }}

@endforeach
```

Permissions
-----------

[](#permissions)

The package creates the following permissions:

- `view testimonials`
- `create testimonials`
- `update testimonials`
- `delete testimonials`
- `approve testimonials`
- `reject testimonials`

### Roles

[](#roles)

**Admin Role:**

- All permissions

**Moderator Role:**

- view, approve, reject

**User Role:**

- view, create, update

### Assigning Permissions

[](#assigning-permissions)

```
$user->assignRole('admin');
// or
$user->givePermissionTo('approve testimonials');
```

Model Usage
-----------

[](#model-usage)

### Basic Queries

[](#basic-queries)

```
use samkumar\Testimonials\Models\Testimonial;

// Get all approved testimonials
$testimonials = Testimonial::approved()->get();

// Get pending testimonials
$pending = Testimonial::pending()->get();

// Get high-rated testimonials
$highRated = Testimonial::highRated(4)->get();

// Get testimonials by location
$byLocation = Testimonial::byLocation('New York')->get();

// Get testimonials by company
$byCompany = Testimonial::byCompany('Tech Corp')->get();

// Order by latest
$latest = Testimonial::latest()->get();

// Order by rating
$byRating = Testimonial::orderByRating('desc')->get();
```

### Increment Views

[](#increment-views)

```
$testimonial = Testimonial::find(1);
$testimonial->incrementViews();
```

### Get Average Rating

[](#get-average-rating)

```
$average = Testimonial::approved()->avg('rating');
```

Factory Usage
-------------

[](#factory-usage)

### Create Single Testimonial

[](#create-single-testimonial)

```
$testimonial = Testimonial::factory()->create();
```

### Create with State

[](#create-with-state)

```
// Create approved testimonial
$approved = Testimonial::factory()->approved()->create();

// Create pending testimonial
$pending = Testimonial::factory()->pending()->create();

// Create rejected testimonial
$rejected = Testimonial::factory()->rejected()->create();
```

### Create Multiple

[](#create-multiple)

```
$testimonials = Testimonial::factory()->count(10)->create();
```

Customization
-------------

[](#customization)

### Override Views

[](#override-views)

Publish views and modify them as needed:

```
php artisan vendor:publish --provider="samkumar\Testimonials\TestimonialsServiceProvider" --tag="testimonials-views"
```

Views will be published to `resources/views/vendor/testimonials/`

### Custom Model

[](#custom-model)

Extend the model for additional functionality:

```
namespace App\Models;

use samkumar\Testimonials\Models\Testimonial as BaseTestimonial;

class Testimonial extends BaseTestimonial
{
    // Add custom methods
}
```

### Custom Controller

[](#custom-controller)

Extend the controller for additional logic:

```
namespace App\Http\Controllers;

use samkumar\Testimonials\Controllers\TestimonialController as BaseController;

class TestimonialController extends BaseController
{
    // Override methods
}
```

Events (Future)
---------------

[](#events-future)

Currently, no events are fired. Custom events can be added in your extended controller.

Testing
-------

[](#testing)

Run the seeder to generate dummy data:

```
php artisan db:seed --class="samkumar\Testimonials\Database\Seeders\TestimonialsSeeder"
```

File Upload
-----------

[](#file-upload)

Photos are stored in the `storage/app/public/testimonials/` directory. Make sure symbolic link exists:

```
php artisan storage:link
```

Access photos at: `storage/testimonials/filename`

Troubleshooting
---------------

[](#troubleshooting)

### Migrations not found

[](#migrations-not-found)

Make sure to publish migrations:

```
php artisan vendor:publish --provider="samkumar\Testimonials\TestimonialsServiceProvider" --tag="testimonials-migrations"
```

### Views not found

[](#views-not-found)

Publish views or configure view namespace in service provider.

### Permission errors

[](#permission-errors)

Run the permission seeder:

```
php artisan db:seed --class="samkumar\Testimonials\Database\Seeders\TestimonialsPermissionSeeder"
```

Support
-------

[](#support)

For issues and questions, please create an issue on GitHub.

License
-------

[](#license)

The Testimonials Package is open-sourced software licensed under the MIT license.

Author
------

[](#author)

Created with ❤️ by samkumar Islam

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance47

Moderate activity, may be stable

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/7dbf89fd14785d0fa376e77e3b50b81879198c5881793341ff7b643f9251699c?d=identicon)[shivam0214](/maintainers/shivam0214)

---

Top Contributors

[![sam02102022](https://avatars.githubusercontent.com/u/226306493?v=4)](https://github.com/sam02102022 "sam02102022 (3 commits)")

### Embed Badge

![Health badge](/badges/samkumar-testimonials/health.svg)

```
[![Health](https://phpackages.com/badges/samkumar-testimonials/health.svg)](https://phpackages.com/packages/samkumar-testimonials)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
