Search by

yeknava / simple-ticketing

yeknava.1

Support tickets and conversations for Laravel applications

Package info

github.com/oneapplab/simple-ticketing

pkg:composer/yeknava/simple-ticketing

Statistics

Installs: 173

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

2.0 2026-12-04 13:55 UTC

This package is auto-updated.

Last update: 2026-12-04 15:12:19 UTC


README

Add support conversations to a Laravel application. Each ticket has one requester, one ordered message history, and an independent status. Staff can reply, resolve, close, reopen, and assign tickets. The host app can also link tickets to business records and grant access to additional participants.

Install

Requires Laravel 13, Filament 5.12.4 or later in the 5.x series, and PHP 8.4.1 or later in the PHP 8 series.

composer require yeknava/simple-ticketing
php artisan vendor:publish --tag=simple-ticketing-config
php artisan vendor:publish --tag=simple-ticketing-migrations
php artisan migrate

This breaking release requires a fresh ticket schema. Run the migration when using database storage.

Use the built-in HTTP API

Set use_routes to true in the published configuration. The default middleware uses Laravel web sessions, CSRF protection, throttling, and authentication. Token-based applications can set middleware and auth_middleware to the corresponding middleware for their API.

Define the manage-simple-tickets gate in your application to grant access to the staff API. For example, an app with its own isSupportStaff() method could register this in its service provider.

Gate::define('manage-simple-tickets', fn (User $user): bool => $user->isSupportStaff());
Method Default path Access
GET /tickets/catalog Public
POST /tickets Authenticated by default
GET /tickets Authenticated, scoped to owned and shared tickets
GET /tickets/{ticket} Requester or participant
GET, POST /tickets/{ticket}/messages Requester or participant
GET /tickets/staff Staff
GET /tickets/staff/{ticket} Staff
GET, POST /tickets/staff/{ticket}/messages Staff
PATCH /tickets/staff/{ticket}/status Staff
  • Create requests take title and body, plus optional type, category, priority, email, name, and phone. Categories and priorities come from the catalog. Stored submissions return HTTP 201 and a ULID in ticket_id.
  • Ticket lists accept status, category, and priority filters. Ticket lists and message histories are paginated. Contact information is available through the staff API.
  • Reply requests take a body and optional type. For an image or file reference, send "type": "image" or "type": "file" and put its URL or storage path in body. Message responses include type, which is null for plain text.
  • Status requests take open, in_progress, resolved, or closed in the status field. Messages can be added to open and in-progress tickets. Reopen a resolved or closed ticket to continue the conversation.
  • Enable allow_guest_submissions to accept public submissions with an email address. A guest receives a ticket ID for reference. Reading or replying through the requester API requires an authenticated account with ticket access. Guest-enabled intake uses the default guard unless you list named guards in guest_submission_guards. Set that list to ['sanctum'], for example, if authenticated submissions use Sanctum.
  • The standalone HTTP routes handle tickets without a tenant. Use a tenant-aware integration for tickets submitted with a tenant.

Use Filament panels

Keep store_in_database enabled and register the plugin in each panel provider.

use Yeknava\SimpleTicketing\Filament\SimpleTicketingPlugin;

// In the customer panel's panel() method
$panel->plugin(SimpleTicketingPlugin::forUsers());

// In the admin panel's panel() method
$panel->plugin(SimpleTicketingPlugin::forAdmins());

In the customer panel, Tickets lets users submit tickets, open conversations they requested or participate in, and reply. In the admin panel, Tickets gives support staff a searchable queue with filters, requester contact details, replies, and status changes. The admin panel uses the manage-simple-tickets gate with the panel's authenticated user. Keep your panel's authentication middleware and FilamentUser::canAccessPanel() configured as usual.

Select Image or File as the message type and paste the address into the message field. The conversation displays HTTP and HTTPS addresses for these messages as links.

Languages

The ticketing screens follow the active Laravel locale, just like Filament. English (en) and Persian (fa) are included. Set APP_LOCALE=fa for Persian by default, or use your panel's existing locale switcher. Filament applies the Persian right-to-left layout.

To customize text or add a language, place a tickets.php translation file in lang/vendor/simple-ticketing/{locale}/ in your application. To translate a configured category or priority, add its exact label under catalog.categories or catalog.priorities in that file. These translations apply to both the panel and the HTTP catalog. The catalog continues to use the configured label if no translation exists, and ticket data keeps its original values.

Tenancy

For a panel configured with Filament's ->tenant(Team::class), the plugin saves new tickets to the active tenant and requires tenant membership for listing, opening, and replying. In an admin panel with tenancy, the staff gate can also accept the active tenant as its optional second argument. Filament tenancy setup

A panel without Filament tenancy shows tickets without a tenant. For a central support panel serving every tenant, register SimpleTicketingPlugin::forAdmins(acrossTenants: true) on a panel without tenancy and grant the gate only to staff authorized across tenants. The queue displays the tenant for each ticket.

Integrate from PHP

Inject TicketService into your application code when you want to use your own controllers or UI. submit() accepts an optional Eloquent requester, an optional Eloquent source such as an order, optional application metadata, and an optional Eloquent tenant. Relationships support integer, UUID, and ULID keys.

use Yeknava\SimpleTicketing\TicketService;
use Yeknava\SimpleTicketing\TicketStatus;

$ticket = $tickets->submit(
    ['title' => 'Invoice issue', 'body' => 'The total is wrong.'],
    requester: $customer,
    source: $order,
    metadata: ['invoice' => 'INV-123'],
);

$tickets->addParticipant($ticket, $colleague);
$tickets->assign($ticket, $supportAgent);
$tickets->staffReply($ticket, 'We corrected the invoice.', $supportAgent);
$tickets->staffReply($ticket, 'https://example.com/invoices/INV-123.pdf', $supportAgent, type: 'file');
$tickets->changeStatus($ticket, TicketStatus::Resolved);

Use reply() for requester and participant messages. Authorize calls to staffReply(), changeStatus(), assign(), and participant management in your application. Pass null to assign() to clear an assignment. The ticket also exposes Eloquent messages, participants, requester, assignee, source, and tenant relationships. Use SimpleTicket::query()->forTenant($tenant) to scope queries and authorize tenant access in your own entry points.

Email delivery

Set ST_ADMIN_EMAIL to receive new submissions and customer replies. Staff replies go to the ticket's contact email when supplied. Set notify_requester_on_reply to false to disable those emails. In database mode, notifications run after commit and delivery errors are reported through the host application's exception handler. Stored tickets and messages remain available on a delivery failure.

For an email-only intake form, set store_in_database to false and configure ST_ADMIN_EMAIL. The built-in routes expose only submission and the catalog. On a successful email-only submission, submit() returns null and the HTTP endpoint returns HTTP 200 with a null ticket ID.

Development

composer install
vendor/bin/phpunit
vendor/bin/phpstan analyse --memory-limit=512M

License

MIT