php-slack / slack

A simple PHP package for sending messages to Slack, with a focus on ease of use and elegant syntax.
BSD 2-Clause "Simplified" License
135 stars 27 forks source link

README is outdated #58

Closed NinoSkopac closed 3 years ago

NinoSkopac commented 3 years ago

This is not how it works anymore, I believe:

Screenshot 2020-12-13 at 08 30 48

it's more like this:

    protected function triggerNotification(string $from, string $messageText): void {
        $client = new Client($this->notificationsHook);
        $message = new Message($client);
        $message->setUsername($from)->setText($messageText);
        $client->sendMessage($message);
    }
cmbuckley commented 3 years ago

Client::send is captured by Client::__call, so $client->send('Hello world!') is a shorthand for:

$message = $client->createMessage();
$message->send('Hello world!');

Other than the username, those snippets achieve the same thing.

NinoSkopac commented 3 years ago

Ah okay.

I used to use Client::send() but have shifted to the new paradigm because my IDE (PHPStorm) was saying the aforementioned method doesn't exist.

cmbuckley commented 3 years ago

Ah OK, in master branch these are documented using @method properties which PHPStorm respects — this will be in an upcoming release