frlnc / php-slack Goto Github PK
View Code? Open in Web Editor NEWA lightweight PHP implementation of Slack's API.
A lightweight PHP implementation of Slack's API.
Looking into the last commit date and comparing this library functionality with the actual Slack API I want to know - if it makes sense to contribute to the library?
The current version on composer is broken. 0779766 fixes it and it should be pushed to composer.
I see you have some Laravel projects so could you make L5 integration for this lib (service provider + facade)?
Any plans to add these methods to the package? Some other packages like https://github.com/Lisennk/Laravel-Slack-Web-API rely on php-slack, and can't access the above 2 methods without custom overrides.
Hi, I see in the composer file that there is some stuff for unit testing, but I don't see unit test.
Can you add it? If there is not, thanks to say it, so in this way someone can implemetned it.
Hello,
I found a bug with files.upload. Due to the use of http_build_query() in src/Http/CurlInteractor.php, the '@' before the filename is being urlencoded, causing cURL to not attempt a file upload. I think this can be changed to remove "http_build_query", but I have a feeling that it's there for a reason.
Is there some way this cane be worked around?
public function post($url, array $urlParameters = [], array $postParameters = [], array $headers = [])
{
$request = $this->prepareRequest($url, $urlParameters, $headers);
curl_setopt($request, CURLOPT_POST, count($postParameters));
curl_setopt($request, CURLOPT_POSTFIELDS, http_build_query($postParameters));
# this is the edited line, that makes the request work:
#curl_setopt($request, CURLOPT_POSTFIELDS, $postParameters);
return $this->executeRequest($request);
}
the request used:
$res = $slack->execute('files.upload', [
'file' => '@derp.jpg',
'filename' => 'derp.jpg',
]);
response using code in master
:
array(3) {
["status_code"]=>
int(200)
["headers"]=>
array(4) {
["Host"]=>
string(9) "slack.com"
["Accept"]=>
string(3) "*/*"
["Content-Length"]=>
string(3) "154"
["Content-Type"]=>
string(33) "application/x-www-form-urlencoded"
}
["body"]=>
array(2) {
["ok"]=>
bool(false)
["error"]=>
string(12) "no_file_data"
}
}
expected/response with edited code:
array(3) {
["status_code"]=>
int(200)
["headers"]=>
array(5) {
["Host"]=>
string(9) "slack.com"
["Accept"]=>
string(3) "*/*"
["Content-Length"]=>
string(5) "66013"
["Expect"]=>
string(12) "100-continue"
["Content-Type"]=>
string(70) "multipart/form-data; boundary=----------------------------d5bae95ca2b5"
}
["body"]=>
array(2) {
["ok"]=>
bool(true)
["file"]=>
array(35) { ... }
}
}
I'm just curious..
Why don't you guys use: http://php.net/htmlspecialchars on format() method?
https://github.com/Frlnc/php-slack/blob/master/src/Core/Commander.php#L355-L362
Needed a quick way stop URL markup from being munged on post. Slack accepts <http://foo.bar|Text Description>
, but chat.postMessage always calls Commander::format() for the text block. Simple change to line 465 fixes it:
- if (isset($command['format']))
+ if (isset($command['format']) and !isset($parameters['no_format']))
Ho, in the exemple you speak about "xoxp-some-token-for-slack".
I suppose it's the oauth token? If it's correct, perhaps you should add an explanation about how to add this one (even by using another libs).
After i use the example in the readme i get this one:
[Sun Jan 25 20:11:34 2015] PHP Fatal error: Class 'Frlnc\Slack\Http\CurlInteractor' not found in /Volumes/NIKON D7000/php-slack/index.php on line 7
[Sun Jan 25 20:11:34 2015] ::1:56216 [500]: / - Class 'Frlnc\Slack\Http\CurlInteractor' not found in /Volumes/NIKON D7000/php-slack/index.php on line 7
Hey,
I'm trying to use this in a small project of mine, but I'm getting
PHP Fatal error: Class 'Frlnc\\Slack\\Http\\CurlInteractor' not found in /path/to/file/calling/new/cur/interactor
I think I may have installed improperly, so for reference, my composer.json
is as follows:
{
"name" : "teltech/q2a-slackbot",
"keywords" : ["slack", "Q2A"],
"license" : "MIT",
"require" : {
"php" : ">=5.4.0",
"frlnc/php-slack" : ">=1.0.0"
}
}
Any advice for fixing this?
If this could be added, that would be much appreciated. :)
'reactions.list' => [
'token' => true,
'endpoint' => '/reactions.list'
],
I cannot loop through the history of the messages posted to the channel though I can view all the key-value pairs in the array.
This is my response:
object(Frlnc\Slack\Http\SlackResponse)#6 (3) {
["body":protected]=>
array(3) {
["ok"]=>
bool(true)
["messages"]=>
array(73) {
[0]=>
array(4) {
......
This is the error I get when trying to access the array:
Fatal error: Uncaught Error: Cannot access protected property Frlnc\Slack\Http\SlackResponse::$body in C:\xampp\htdocs\fair\slack.php:37
Stack trace:
#0 {main}
thrown in C:\xampp\htdocs\fair\slack.php on line 37
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.