sergeybruhin/laravel-service

Laravel service layer stubs and utils

Maintainers

Package info

github.com/sergeybruhin/laravel-service

pkg:composer/sergeybruhin/laravel-service

Transparency log

Statistics

Installs: 121

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-09 13:12 UTC

This package is auto-updated.

Last update: 2026-07-09 13:12:54 UTC


README

Latest Version on Packagist Total Downloads

sergeybruhin/laravel-service provides service-module generators for Laravel applications.

It creates a dedicated service structure with providers, contracts, facades, actions, handlers, events, broadcast events, listeners, jobs, commands, data objects, DTOs, and exceptions.

Requirements

  • PHP 8.2+
  • Laravel 11+

Installation

composer require sergeybruhin/laravel-service

Create a Service

php artisan service:create Delivery

This creates the service shell:

app/Services/Delivery/
  Actions/
  Commands/
  Data/
  Dto/
  Events/
  Exceptions/
  Facade/
    DeliveryService.php
  Handlers/
  Interfaces/
    DeliveryServiceContract.php
  Jobs/
  Listeners/
  Providers/
    EventServiceProvider.php
    ServiceProvider.php
  DeliveryService.php

You may also use the backward-compatible aliases:

php artisan make:service Delivery
php artisan create:service Delivery

Full Service Scaffold

php artisan service:create Delivery --full

The --full option also creates default extendable service artifacts:

Actions/DefaultAction.php
Handlers/DefaultHandler.php
Events/DefaultEvent.php
Events/DefaultBroadcastEvent.php
Listeners/DefaultListener.php
Jobs/DefaultJob.php
Commands/DefaultCommand.php
Exceptions/DeliveryException.php
Data/DefaultData.php
Dto/DefaultDto.php

Generate Service Artifacts

php artisan service:action Delivery CreateShipmentAction
php artisan service:handler Delivery SyncShipmentsHandler
php artisan service:job Delivery SyncShipmentsJob
php artisan service:event Delivery ShipmentCreatedEvent
php artisan service:event Delivery ShipmentUpdatedEvent --broadcast
php artisan service:broadcast-event Delivery ShipmentStatusChangedEvent
php artisan service:listener Delivery SendShipmentNotificationListener
php artisan service:command Delivery SyncShipmentsCommand

All generators support:

--force
--path=app/Services
--namespace=App\\Services

Package Support Classes

Generated events, broadcast events, listeners, and exceptions extend package-level support classes:

SergeyBruhin\LaravelService\Support\Events\DefaultEvent
SergeyBruhin\LaravelService\Support\Events\BroadcastEvent
SergeyBruhin\LaravelService\Support\Listeners\DefaultListener
SergeyBruhin\LaravelService\Support\Exceptions\ServiceException

These defaults keep service modules consistent without copying shared abstract classes into every application.

Checklist

  • Add ability to create Actions for specific service
  • Add ability to create Handlers for specific service
  • Add ability to create Jobs for specific service
  • Add ability to create Events for specific service
  • Add ability to create Broadcast Events for specific service
  • Add ability to create Listeners for specific service
  • Add ability to create Commands for specific service
  • Add full service scaffold option
  • Add package-level support classes
  • Add tests

Testing

composer test

Changelog

Please see CHANGELOG for more information about what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email sundaycreative@gmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.