Tiger_Service_Service

@api

Tiger_Service_Service — abstract base for every /api service.

This is the class services extend SO THAT they can consume and route API requests. Ported from AskLevi's Levi_Service_Service (the proven TIGER pattern from the "REST is Dying" design): the ServiceFactory constructs a concrete child with the WHOLE request message, and the base routes it to the action method named by the message. The action receives the entire $params payload — you don't hand-wire arguments; the message IS the argument.

class Billing_Service_Invoice extends Tiger_Service_Service { public function create(array $params): void { if (!$this->_isAdmin()) { $this->_error('core.api.error.not_allowed'); return; } // ... do work with $params ... $this->_success($invoice); } }

The caller then just reads getResponse() — all the work happened during construction. That's the "slick" bit from the article: instantiate, and it's already done.

Methods

__construct()

__construct(array $params = [])

Construct the service with the whole request message and dispatch it — by the time this returns the named action has run and the response is ready.

  • $params array — the full request message/payload

getResponse()

getResponse()

The response object built during construction/dispatch.

Returns Tiger_Model_ResponseObject