--- title: "Interfaces" slug: "php-interfaces" description: "Reference of the PHP Library interfaces for cookies, loggers and custom consumers, incl. MappIntelligenceBatchResultConsumer to discard batches. " status: "update" updated: 2026-11-02T14:49:11Z published: 2026-11-02T14:49:11Z canonical: "docs.mapp.com/php-interfaces" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.mapp.com/llms.txt > Use this file to discover all available pages before exploring further. # Interfaces This section includes the available interfaces with examples. **MappIntelligenceCookie** ### Methods #### setDomain ```php /** * @param string $domain Specifies the domain within which this cookie should be presented. */ public function setDomain($domain); ``` #### getDomain ```php /** * @return string Gets the domain name of this cookie. */ public function getDomain(); ``` #### setMaxAge ```php /** * Sets the maximum age in seconds for this cookie. * * @param integer $expiry Sets the maximum age in seconds for this cookie. */ public function setMaxAge($expiry); ``` #### getMaxAge ```php /** * Gets the maximum age in seconds of this cookie. * * @return integer Gets the maximum age in seconds of this cookie. */ public function getMaxAge(); ``` The value is relative (e.g. 15552000 = 180 days for the everID cookie, -1 for a session cookie). For `setcookie()` use `time() + $cookie->getMaxAge()` as expiry, or `0` for a session cookie. #### setPath ```php /** * @param string $uri Specifies a path for the cookie to which the client should return the cookie. */ public function setPath($uri); ``` #### getPath ```php /** * @return string Returns the path on the server to which the browser returns this cookie. */ public function getPath(); ``` #### setSecure ```php /** * @param bool $flag Indicates to the browser whether the cookie should only be sent using a secure protocol, *                   such as HTTPS or SSL. */ public function setSecure($flag); ``` #### isSecure ```php /** * @return bool Returns true if the browser is sending cookies only over a secure protocol, or false if the browser *              can send cookies using any protocol. */ public function isSecure(); ``` #### getName ```php /** * @return string Returns the name of the cookie. */ public function getName(); ``` #### getValue ```php /** * @return string Gets the current value of this cookie. */ public function getValue(); ``` #### setHttpOnly ```php /** * @param bool $isHttpOnly Marks or unmarks this cookie as HttpOnly. */ public function setHttpOnly($isHttpOnly); ``` #### isHttpOnly ```php /** * @return bool Checks whether this cookie has been marked as HttpOnly. */ public function isHttpOnly(); ``` **MappIntelligenceLogger** Create your own LoggerClass to debug our Mapp Intelligence PHP library. ### Methods #### log ```php /** * @param string ...$msg Debug message */ public function log(...$msg); ``` #### Example ```php class CustomLogger implements MappIntelligenceLogger { /**     * @param mixed ...$msg Debug message     */    public function log(...$msg)    {        error_log(...$msg);    } } ``` **MappIntelligenceConsumer** Create your own ConsumerClass to use for data transfer to Intelligence. ### Methods #### sendBatch ```php /** * @param array $batchContent List of tracking requests * @return bool */ public function sendBatch(array $batchContent); ``` #### Example ```php class TestCustomPrintConsumer implements MappIntelligenceConsumer { /** * @param array $batchContent List of tracking requests * @return bool */ public function sendBatch(array $batchContent) { for ($i = 0; $i < count($batchContent); $i++) { echo $batchContent[$i] . "\n"; } return true; } } ``` **MappIntelligenceBatchResultConsumer** Optional extension of *MappIntelligenceConsumer*: a consumer implementing it can tell the queue that a batch can never be sent, instead of only "sent" or "retry". Consumers that only implement *MappIntelligenceConsumer* keep working: `true` counts as SENT, `false` as RETRY. ### Methods #### send ```php /** * @param array $batchContent List of tracking requests * @return string MappIntelligenceBatchResult::SENT, ::RETRY or ::DISCARDED */ public function send(array $batchContent); ``` | Result | Meaning | | --- | --- | | MappIntelligenceBatchResult::SENT | The batch was delivered. | | MappIntelligenceBatchResult::RETRY | The batch could not be delivered right now, it goes back into the queue and is retried. | | MappIntelligenceBatchResult::DISCARDED | The batch can never be sent (permanent client error, oversized payload). It leaves the queue, but was not delivered either; the flush reports a failure. | An invalid result or an exception counts as RETRY. #### Example ```php class TestCustomResultConsumer implements MappIntelligenceBatchResultConsumer {    public function send(array $batchContent) {        // HTTP status, 0 if there was no response (no connection, timeout)        $status = my_send($batchContent);        if ($status > 0 && $status < 400) {            return MappIntelligenceBatchResult::SENT;        }        if ($status >= 400 && $status < 500 && $status !== 408 && $status !== 429) {            return MappIntelligenceBatchResult::DISCARDED;        }        // no response, 408, 429 and 5xx: try again later        return MappIntelligenceBatchResult::RETRY;    }    public function sendBatch(array $batchContent) {        return $this->send($batchContent) === MappIntelligenceBatchResult::SENT;    } } ```