src/ChrisKonnertz/DeepLy/DeepLy.php
public function requestSplitText($text, $from = self::LANG_AUTO)
    {
        if (! is_string($text) and ! is_array($text)) {
            throw new \InvalidArgumentException('The $text argument has to be a string or an array of strings');
        }
        if (is_array($text)) {
            foreach ($text as $index => $part) {
                if (! is_string($part)) {
                    throw new \InvalidArgumentException(
                        'If the $text argument is an array it ha to be an array of strings, but the '.($index + 1).
                        '. item is not a string'
                    );
                }
            }
        } else {
            $text = [$text];
        }

        $params = [
            'texts' => $text,
            'lang' => [
                'lang_user_selected' => $from
            ]
        ];

        $rawResponseData = $this->httpClient->callApi(self::API_BASE_URL, $params, self::METHOD_SPLIT);

        $responseContent = $this->protocol->processResponseData($rawResponseData);

        $splitTextBag = new SentencesBag($responseContent);

        return $splitTextBag;
    }
public function requestSplitText($text, $from = self::LANG_AUTO)
    {
        if (! is_string($text) and ! is_array($text)) {
            throw new \InvalidArgumentException('The $text argument has to be a string or an array of strings');
        }
        if (is_array($text)) {
            foreach ($text as $index => $part) {
                if (! is_string($part)) {
                    throw new \InvalidArgumentException(
                        'If the $text argument is an array it ha to be an array of strings, but the '.($index + 1).
                        '. item is not a string'
                    );
                }
            }
        } else {
            $text = [$text];
        }

        $params = [
            'texts' => $text,
            'lang' => [
                'lang_user_selected' => $from
            ]
        ];

        $rawResponseData = $this->httpClient->callApi(self::API_BASE_URL, $params, self::METHOD_SPLIT);

        $responseContent = $this->protocol->processResponseData($rawResponseData);

        $splitTextBag = new SentencesBag($responseContent);

        return $splitTextBag;
    }
Uses the DeepL API to split a text into sentences. Stores them in a SentencesBag object and returns it.
You may use the splitText() method if you want to get the result as a string array.
Attention: If you choose to set $from to "auto", the API will not return a result if it is unable to
detect the language.

@param string|string[] $text The text you want to split into sentences. It can be a single string or string array
@param string          $from Optional: The source language, a self::LANG_<code> constant
@return SentencesBag
@throws \Exception