Simple application to send a messages to Slack and listen outgoing messages from Slack and reply those.
- PHP 7.1.3 or higher
- Composer
Use your favorite IDE and get checkout from GitHub or just use following command
git clone https://github.com/protacon/labs-slack-integration.git
Next you need to create .env
file, which contains all the necessary
environment variables that application needs. You can create it by following
command (in folder where you cloned this project):
cp .env.dist .env
Then open that file and make necessary changes to it. Note that this .env
file is ignored on VCS.
Next phase is to install all needed dependencies. This you can do with following command, in your project folder:
composer install
Or if you haven't installed composer globally
curl -sS https://getcomposer.org/installer | php
php composer.phar install
Next thing is to make sure that application var
directory has correct
permissions. Instructions for that you can find
here.
I really recommend that you use ACL
option in your development environment.
To check that your environment is ready for this application. You need to make two checks; one for CLI environment and another for your web-server environment.
You need to run following command to make all necessary checks.
./vendor/bin/requirements-checker
Open terminal and go to project root directory and run following command to start standalone server.
./bin/console server:start
Open your favorite browser with http://127.0.0.1:8000/check.php
url and
check it for any errors.
You need to configure your Slack to connect to this
application. And to do that open https://[your_slack].slack.com/customize/
in your favorite browser and click Configure Apps
on left hand side menu.
And after that click Custom Integrations
Create new hook as you like, and copy that Webhook URL
to your .env
file
SLACK_WEBHOOK_URL
value.
Create new hook as you like, and set this application URL to URL(s)
section
on configuration. Then copy token
to your .env
file SLACK_TOKEN
value.
I highly recommend that you use "proper" IDE to development your application. Below is short list of some popular IDEs that you could use.
Personally I recommend PhpStorm, but just choose one which is the best for you.
Also note that project contains .idea
folder that holds default settings for
PHPStorm.
It's highly recommended that you use this tool while doing actual development
to application. PHP Code Sniffer is added to project dev
dependencies, so
all you need to do is just configure it to your favorite IDE. So the phpcs
command is available via following example command.
./vendor/bin/phpcs -i
If you're using PhpStorm following links will help you to get things rolling.
Todo
Project contains bunch of tests (Functional, Integration, Unit) which you can run simply by following command:
./bin/phpunit
Note that you need to create .env.test
file to define your testing
environment. This file has the same content as the main .env
file, just
change it to match your testing environment.
Or you could easily configure your IDE to run these for you.
After you have run tests you can see actual code coverage by opening
./build/report/index.html
with your favorite browser
Project also contains PhpMetrics to make some analyze of your code. You can run this by following command:
./vendor/bin/phpmetrics --junit=build/logs/junit.xml --report-html=build/phpmetrics .
And after that open build/phpmetrics/index.html
with your favorite browser.
- Symfony Flex set to enable RAD (Rapid Application Development)
- Symfony 4: A quick Demo
- Symfony Development using PhpStorm
- Symfony Plugin plugin for PhpStorm
- PHP Annotations plugin for PhpStorm
- Php Inspections (EA Extended) plugin for PhpStorm
- EditorConfig
- composer-version
- Symfony Recipes Server
Copyright © 2018 Protacon Solutions Ltd