PHP code example of jeremykenedy / slack-laravel

1. Go to this page and download the library: Download jeremykenedy/slack-laravel library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

jeremykenedy / slack-laravel example snippets


    'providers' => [
        jeremykenedy\Slack\Laravel\ServiceProvider::class,
    ];

    'aliases' => [
        'Slack' => jeremykenedy\Slack\Laravel\Facade::class,
    ];

DEFAULT_SLACK_WEBHOOK_ENDPOINT=https://hooks.slack.com/services/XXXXXXXX/XXXXXXXX/XXXXXXXXXXXXXX
DEFAULT_SLACK_CHANNEL='#general'
DEFAULT_SLACK_USERNAME=Robot
DEFAULT_SLACK_ICON=':ghost:'
DEFAULT_SLACK_LINKNAMES_CONVERTED=FALSE
DEFAULT_SLACK_UNFURL_LINKS_STATUS=FALSE
DEFAULT_SLACK_UNFURL_MEDIA_STATUS=TRUE
DEFAULT_SLACK_ALLOW_MARKDOWN=TRUE
DEFAULT_SLACK_MARKDOWN_FIELDS="'text','title'"

\Slack::send('Hey');

    Slack::send('Hi Slack, from the API :)');

    Slack::to('#testing')->send('Hi Testing!');

    Slack::to('@jeremykenedy')->send('Hi Jeremy!');

    Slack::fake()

    Slack::assertMessageSent(function($messages) {
        // search in all messages
    });

    Slack::assertMessageSentTo($channel, function($messages) {
        // search in all messages posted to $channel
    });
bash
    php artisan vendor:publish --tag=slacklaravel