itmosoft / laravel-service-listings
Service provider profiles and service listings for Laravel applications, with polymorphic ownership, categories, pricing models, and publication workflows.
Package info
github.com/ITMOSOFT/laravel-service-listings
pkg:composer/itmosoft/laravel-service-listings
Requires
- php: ^8.3
- illuminate/contracts: ^12.0 || ^13.0
- illuminate/database: ^12.0 || ^13.0
- illuminate/support: ^12.0 || ^13.0
Requires (Dev)
- orchestra/testbench: ^10.0 || ^11.0
- phpunit/phpunit: ^11.5 || ^12.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Reusable service-provider profiles and service listings for Laravel 12 and 13 applications.
Features
- Polymorphic service-provider ownership (users, companies, vendors, or custom models).
- Provider profile details, contact information, status, and verification flag.
- Hierarchical service categories.
- Provider-owned service listings with summary, description, category, and metadata.
- Pricing models:
quote,fixed,hourly,daily,starting_at, or application-defined values. - Publication lifecycle:
draft,pending,published, andarchived. - Optional availability date range and featured flag.
- Eloquent relationships and a
HasServiceListingstrait.
Requirements
- PHP 8.3+
- Laravel 12 or 13
- SQLite extension for the included test suite
Installation
composer require itmosoft/laravel-service-listings php artisan vendor:publish --tag=service-listings-config php artisan migrate
Migrations are loaded automatically. Publishing the config is optional.
Basic usage
use ITMOSOFT\ServiceListings\Models\ServiceProvider; use ITMOSOFT\ServiceListings\Models\ServiceCategory; use ITMOSOFT\ServiceListings\Models\ServiceListing; $provider = ServiceProvider::create([ 'owner_type' => User::class, 'owner_id' => $user->id, 'display_name' => 'Acme Services', 'slug' => 'acme-services', 'email' => 'hello@example.com', ]); $category = ServiceCategory::create([ 'name' => 'Home Services', 'slug' => 'home-services', ]); $listing = ServiceListing::create([ 'provider_type' => ServiceProvider::class, 'provider_id' => $provider->id, 'category_id' => $category->id, 'title' => 'Deep Home Cleaning', 'slug' => 'deep-home-cleaning', 'pricing_model' => 'fixed', 'price_amount' => 120.00, 'currency' => 'USD', ]); $listing->publish();
The provider morph relation on a listing points to the model stored in provider_type / provider_id. In the example above, that model is ServiceProvider; provider profiles themselves are polymorphically owned by the user/company model.
Add the trait to an owner model
use ITMOSOFT\ServiceListings\Concerns\HasServiceListings; class User extends Authenticatable { use HasServiceListings; }
serviceProviderProfile() returns the owner's provider profile relation. serviceListings() returns listings directly owned by the model through the listing's provider morph. If listings should belong to a ServiceProvider profile, use $provider->listings().
Lifecycle
publish()publishes onlydraftorpendinglistings and stampspublished_at.unpublish()returns a published listing todraft.archive()moves a listing toarchived.isCurrentlyAvailable()checks publication state and optional date bounds.- Providers can be activated or suspended using
activate()andsuspend().
Important design boundaries
This package stores service listings and provider profiles. It does not implement booking calendars, appointment reservations, dispatch, service fulfillment, payments, invoicing, reviews, messaging, identity verification workflows, or search indexing. The is_verified flag is application-managed and is not a substitute for the separate seller-verification workflow.
The package intentionally does not enforce a fixed list of pricing models or currencies. Validate those values in your application. Add authorization policies, moderation rules, and tenant/store scoping in the host application.
Testing
composer install
composer test
License
MIT. See LICENSE.